I would like to distribute about 30 Python command-line programs that use a single stand-alone Python distribution. Looking at py2app, I only see the following two ways of doing it. Can anyone suggest a better approach?
In all cases: build a *.app bundle app with py2app, and then use relative sym-links to run the command-line binary which is at "<target-name>.app/Contents/MacOS/<target-name>". so the user can see and access the CLI program without having to cd within the bundle app. 1) Build a single CLI app that runs a differnet CLI Python file based on the first command-line argument. - Build a single Python "<target-name>.app" that imports everything needed by any of my separate Python apps. - copy my Python programs into "<target-name>.app/Contents/Resources" - have the main "<target-name>" Python program simply do execfile with sys.argv[1] + ".py" - document that to run the program in the package, the user needs to say: "<target-name> <command-name> <command-arguments" 2) Change the "<target-name>.app" start-up data so that you can have several CLI apps in "<target-name>.app/Contents/MacOS", usch that one each runs a different Python program under "<target-name>.app/Contents/Resources". I notice that the "<target-name>.app/Contents/Info.plist" file contains the key-value pair " PyMainFileNames"-"<boot-file-name>". The CLI program "<target-name>.app/Contents/MacOS/<target-name>" references this key name to get the list of strings, and for each name, will try to run the matching Python boot file in "<target-name>.app/Contents/Resources". This boot file in turn fixes up the Python sys paths, and then uses execfile to run the Python file "<target-name>.py". I verified that I can achieve what I want to do here by a crude manual approach : - make multiple copies of the "<target-name>" file under "<target-name>.app/Contents/MacOS/" - edit the data string " PyMainFileNames" in each one to be a different string (of the same length!) - add key-value pairs to "<target-name>.app/Contents/Info.plist" defining a different boot-file name value for each different key value - make multiple copies of the boot file under "<target-name>.app/Contents/Resources", one for each name I supplied in the Info.plist file, and edit each so that it starts a different CLI program. Obviously, for production, I would modify the py2app code to do this. Any better ideas? Read Roberts Adobe SJ on Weds, home office 415-642-5642 other days _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig