summaryrefslogtreecommitdiffstats
path: root/Tools/freeze/freeze.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-06-17 17:49:13 (GMT)
committerGuido van Rossum <guido@python.org>1996-06-17 17:49:13 (GMT)
commitd4cc04c672bd93757f14da1fc812850668c3d371 (patch)
tree443274514eb0bce3d89dadd7e7e3b1ebcd80a78a /Tools/freeze/freeze.py
parentf75f80eb48d2afd646ee49c2ff6e71ae8239d4be (diff)
downloadcpython-d4cc04c672bd93757f14da1fc812850668c3d371.zip
cpython-d4cc04c672bd93757f14da1fc812850668c3d371.tar.gz
cpython-d4cc04c672bd93757f14da1fc812850668c3d371.tar.bz2
Add test that script name ends in .py.
Cosmetic changes to usage message (refer to "make install" now).
Diffstat (limited to 'Tools/freeze/freeze.py')
-rwxr-xr-xTools/freeze/freeze.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/Tools/freeze/freeze.py b/Tools/freeze/freeze.py
index 1fe5553..6e8af82 100755
--- a/Tools/freeze/freeze.py
+++ b/Tools/freeze/freeze.py
@@ -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)