[Zope-Checkins] CVS: Zope/inst - install.py:1.1.2.8

Fred L. Drake, Jr. fred@zope.com
Tue, 3 Dec 2002 15:52:20 -0500


Update of /cvs-repository/Zope/inst
In directory cvs.zope.org:/tmp/cvs-serv22019

Modified Files:
      Tag: chrism-install-branch
	install.py 
Log Message:
- Use a conventional exit code of 2 for command-line errors
- Always include at least a small hint of the error
- Move code that can't raise getopt.GetoptError outside the try/except
  for that error


=== Zope/inst/install.py 1.1.2.7 => 1.1.2.8 ===
--- Zope/inst/install.py:1.1.2.7	Tue Dec  3 14:33:13 2002
+++ Zope/inst/install.py	Tue Dec  3 15:52:20 2002
@@ -139,29 +139,28 @@
 
 if __name__ == '__main__':
     if len(sys.argv) < 3:
+        print "too few arguments"
         usage()
-        # XXX Why 127 instead of 2?
-        sys.exit(127)
+        sys.exit(2)
     symlinks = 1
     dirmode = 0755
     fmode   = 0644
     omitpattern = default_omitpattern
     retain_xbit = 1
+    longopts = ['copylinks', 'dirmode=', 'fmode=', 'omitpattern=', 'help',
+                'copyxmode' ]
     try:
-        longopts = ['copylinks', 'dirmode=', 'fmode=', 'omitpattern=', 'help',
-                    'copyxmode' ]
         opts, args = getopt.getopt(sys.argv[1:], 'h', longopts)
     except getopt.GetoptError, v:
         print v
         usage()
-        # XXX Shouldn't this be 2?
-        sys.exit(1)
+        sys.exit(2)
     try:
         source, dest = args
     except:
+        print "wrong number of arguments"
         usage()
-        # XXX Shouldn't this be 2?
-        sys.exit(1)
+        sys.exit(2)
     for o, a in opts:
         if o in ('-h', '--help'):
             usage()