From 1dbbab9ea08c873e820ad1bb32a3db158bda7e72 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 16 Oct 2009 00:22:47 +0000 Subject: [PATCH] use -o for output --- direct/src/p3d/packp3d.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/direct/src/p3d/packp3d.py b/direct/src/p3d/packp3d.py index 8518715005..eb3b92f55c 100755 --- a/direct/src/p3d/packp3d.py +++ b/direct/src/p3d/packp3d.py @@ -12,10 +12,13 @@ also be used to build p3d applications, using a pdef description file. Usage: - %s [opts] app.p3d + %s [opts] -o app.p3d Options: + -o app.p3d + Specify the name of the p3d file to generate. This is required. + -d application_root Specify the root directory of the application source; this is a directory tree that contains all of your .py files and models. @@ -76,10 +79,11 @@ class ArgumentError(StandardError): pass def makePackedApp(args): - opts, args = getopt.getopt(args, 'd:m:S:c:r:s:Dh') + opts, args = getopt.getopt(args, 'o:d:m:S:c:r:s:Dh') packager = Packager.Packager() + appFilename = None root = Filename('.') main = None configFlags = [] @@ -87,7 +91,9 @@ def makePackedApp(args): allowPythonDev = False for option, value in opts: - if option == '-d': + if option == '-o': + appFilename = Filename.fromOsSpecific(value) + elif option == '-d': root = Filename.fromOsSpecific(value) elif option == '-m': main = value @@ -109,13 +115,12 @@ def makePackedApp(args): print usageText % (os.path.split(sys.argv[0])[1]) sys.exit(1) - if not args: - raise ArgumentError, "No target app specified. Use:\n%s app.p3d" % (os.path.split(sys.argv[0])[1]) + if not appFilename: + raise ArgumentError, "No target app specified. Use:\n%s -o app.p3d" % (os.path.split(sys.argv[0])[1]) - if len(args) > 1: - raise ArgumentError, "Too many arguments." + if args: + raise ArgumentError, "Extra arguments on command line." - appFilename = Filename.fromOsSpecific(args[0]) if appFilename.getExtension() != 'p3d': raise ArgumentError, 'Application filename must end in ".p3d".'