]> granicus.if.org Git - python/commitdiff
Add test that script name ends in .py.
authorGuido van Rossum <guido@python.org>
Mon, 17 Jun 1996 17:49:13 +0000 (17:49 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 17 Jun 1996 17:49:13 +0000 (17:49 +0000)
Cosmetic changes to usage message (refer to "make install" now).

Tools/freeze/freeze.py

index 1fe5553f378b2ad6858f2a3585c7ccd0c4615ef3..6e8af82662116f82c35e7d258bc559fe7ee7456d 100755 (executable)
@@ -16,7 +16,7 @@
 # Usage message
 
 usage_msg = """
-usage: freeze [-p prefix] [-P exec_prefix] [-e extension] script [module] ...
+usage: freeze [-p prefix] [-P exec_prefix] [-e extension] script.py [module]...
 
 -p prefix:    This is the prefix used when you ran
               'Make inclinstall libainstall' in the Python build directory.
@@ -31,7 +31,7 @@ usage: freeze [-p prefix] [-P exec_prefix] [-e extension] script [module] ...
               should also have a Setup file describing the .o files.
               More than one -e option may be given.
 
-script:       The Python script to be executed by the resulting binary.
+script.py:    The Python script to be executed by the resulting binary.
              It *must* end with a .py suffix!
 
 module ...:   Additional Python modules (referenced by pathname)
@@ -41,11 +41,7 @@ module ...:   Additional Python modules (referenced by pathname)
 NOTES:
 
 In order to use freeze successfully, you must have built Python and
-installed it.  In particular, the following two non-standard make
-targets must have been executed:
-
-       make inclinstall
-       make libainstall                # Note: 'liba', not 'lib'
+installed it ("make install").
 
 The -p and -P options passed into the freeze script must correspond to
 the --prefix and --exec-prefix options passed into Python's configure
@@ -163,6 +159,10 @@ def main():
        if not args:
                usage('at least one filename argument required')
 
+       # check that the script name ends in ".py"
+       if args[0][-3:] != ".py":
+               usage('the script name must have a .py suffix')
+
        # check that file arguments exist
        for arg in args:
                if not os.path.exists(arg):
@@ -291,9 +291,10 @@ def main():
 # Print usage message and exit
 
 def usage(msg = None):
-       if msg:
-               sys.stderr.write(str(msg) + '\n')
        sys.stderr.write(usage_msg)
+       # Put the error last since the usage message scrolls off the screen
+       if msg:
+               sys.stderr.write('\nError: ' + str(msg) + '\n')
        sys.exit(2)