diff options
author | Just van Rossum <just@letterror.com> | 2003-07-04 14:20:03 (GMT) |
---|---|---|
committer | Just van Rossum <just@letterror.com> | 2003-07-04 14:20:03 (GMT) |
commit | be56aae36adb029a99c91aa92e0bf54a92815d6a (patch) | |
tree | e534526f34ca8466b9cde9fe44f866b81892df45 /Lib/plat-mac/bundlebuilder.py | |
parent | dd614fdc51fca690be1d7c1f44d06e235f6ba1e7 (diff) | |
download | cpython-be56aae36adb029a99c91aa92e0bf54a92815d6a.zip cpython-be56aae36adb029a99c91aa92e0bf54a92815d6a.tar.gz cpython-be56aae36adb029a99c91aa92e0bf54a92815d6a.tar.bz2 |
#765903:
- added bundle_id/--bundle-id option, to specify the CFBundleIndentifier
#765615:
- in the appropriate situation, prepend $PATH with our path instead of
setting it.
Diffstat (limited to 'Lib/plat-mac/bundlebuilder.py')
-rwxr-xr-x | Lib/plat-mac/bundlebuilder.py | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Lib/plat-mac/bundlebuilder.py b/Lib/plat-mac/bundlebuilder.py index 9c79e30..1c786b8 100755 --- a/Lib/plat-mac/bundlebuilder.py +++ b/Lib/plat-mac/bundlebuilder.py @@ -87,6 +87,9 @@ class BundleBuilder(Defaults): # The creator code of the bundle. creator = None + # the CFBundleIdentifier (this is used for the preferences file name) + bundle_id = None + # List of files that have to be copied to <bundle>/Contents/Resources. resources = [] @@ -126,7 +129,9 @@ class BundleBuilder(Defaults): else: self.creator = "????" plist.CFBundleSignature = self.creator - if not hasattr(plist, "CFBundleIdentifier"): + if self.bundle_id: + plist.CFBundleIdentifier = self.bundle_id + elif not hasattr(plist, "CFBundleIdentifier"): plist.CFBundleIdentifier = self.name def build(self): @@ -278,9 +283,15 @@ libdir = os.path.join(os.path.dirname(execdir), "Frameworks") mainprogram = os.path.join(resdir, "%(mainprogram)s") sys.argv.insert(1, mainprogram) -os.environ["PYTHONPATH"] = resdir -if %(standalone)s: - os.environ["PYTHONHOME"] = resdir +if %(standalone)s or %(semi_standalone)s: + os.environ["PYTHONPATH"] = resdir + if %(standalone)s: + os.environ["PYTHONHOME"] = resdir +else: + pypath = os.getenv("PYTHONPATH", "") + if pypath: + pypath = ":" + pypath + os.environ["PYTHONPATH"] = resdir + pypath os.environ["PYTHONEXECUTABLE"] = executable os.environ["DYLD_LIBRARY_PATH"] = libdir os.environ["DYLD_FRAMEWORK_PATH"] = libdir @@ -475,6 +486,7 @@ class AppBuilder(BundleBuilder): else: hashbang = os.path.realpath(sys.executable) standalone = self.standalone + semi_standalone = self.semi_standalone open(bootstrappath, "w").write(BOOTSTRAP_SCRIPT % locals()) os.chmod(bootstrappath, 0775) @@ -779,6 +791,9 @@ Options: -c, --creator=CCCC 4-char creator code (default: '????') --iconfile=FILE filename of the icon (an .icns file) to be used as the Finder icon + --bundle-id=ID the CFBundleIdentifier, in reverse-dns format + (eg. org.python.BuildApplet; this is used for + the preferences file name) -l, --link symlink files/folder instead of copying them --link-exec symlink the executable instead of copying it --standalone build a standalone application, which is fully @@ -813,7 +828,7 @@ def main(builder=None): "mainprogram=", "creator=", "nib=", "plist=", "link", "link-exec", "help", "verbose", "quiet", "argv", "standalone", "exclude=", "include=", "package=", "strip", "iconfile=", - "lib=", "python=", "semi-standalone") + "lib=", "python=", "semi-standalone", "bundle-id=") try: options, args = getopt.getopt(sys.argv[1:], shortopts, longopts) @@ -841,6 +856,8 @@ def main(builder=None): builder.argv_emulation = 1 elif opt in ('-c', '--creator'): builder.creator = arg + elif opt == '--bundle-id': + builder.bundle_id = arg elif opt == '--iconfile': builder.iconfile = arg elif opt == "--lib": |