Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit be56aae

Browse files
committed
#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.
1 parent dd614fd commit be56aae

1 file changed

Lines changed: 22 additions & 5 deletions

File tree

Lib/plat-mac/bundlebuilder.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ class BundleBuilder(Defaults):
8787
# The creator code of the bundle.
8888
creator = None
8989

90+
# the CFBundleIdentifier (this is used for the preferences file name)
91+
bundle_id = None
92+
9093
# List of files that have to be copied to <bundle>/Contents/Resources.
9194
resources = []
9295

@@ -126,7 +129,9 @@ def setup(self):
126129
else:
127130
self.creator = "????"
128131
plist.CFBundleSignature = self.creator
129-
if not hasattr(plist, "CFBundleIdentifier"):
132+
if self.bundle_id:
133+
plist.CFBundleIdentifier = self.bundle_id
134+
elif not hasattr(plist, "CFBundleIdentifier"):
130135
plist.CFBundleIdentifier = self.name
131136

132137
def build(self):
@@ -278,9 +283,15 @@ def __load():
278283
mainprogram = os.path.join(resdir, "%(mainprogram)s")
279284
280285
sys.argv.insert(1, mainprogram)
281-
os.environ["PYTHONPATH"] = resdir
282-
if %(standalone)s:
283-
os.environ["PYTHONHOME"] = resdir
286+
if %(standalone)s or %(semi_standalone)s:
287+
os.environ["PYTHONPATH"] = resdir
288+
if %(standalone)s:
289+
os.environ["PYTHONHOME"] = resdir
290+
else:
291+
pypath = os.getenv("PYTHONPATH", "")
292+
if pypath:
293+
pypath = ":" + pypath
294+
os.environ["PYTHONPATH"] = resdir + pypath
284295
os.environ["PYTHONEXECUTABLE"] = executable
285296
os.environ["DYLD_LIBRARY_PATH"] = libdir
286297
os.environ["DYLD_FRAMEWORK_PATH"] = libdir
@@ -475,6 +486,7 @@ def preProcess(self):
475486
else:
476487
hashbang = os.path.realpath(sys.executable)
477488
standalone = self.standalone
489+
semi_standalone = self.semi_standalone
478490
open(bootstrappath, "w").write(BOOTSTRAP_SCRIPT % locals())
479491
os.chmod(bootstrappath, 0775)
480492

@@ -779,6 +791,9 @@ def pathjoin(*args):
779791
-c, --creator=CCCC 4-char creator code (default: '????')
780792
--iconfile=FILE filename of the icon (an .icns file) to be used
781793
as the Finder icon
794+
--bundle-id=ID the CFBundleIdentifier, in reverse-dns format
795+
(eg. org.python.BuildApplet; this is used for
796+
the preferences file name)
782797
-l, --link symlink files/folder instead of copying them
783798
--link-exec symlink the executable instead of copying it
784799
--standalone build a standalone application, which is fully
@@ -813,7 +828,7 @@ def main(builder=None):
813828
"mainprogram=", "creator=", "nib=", "plist=", "link",
814829
"link-exec", "help", "verbose", "quiet", "argv", "standalone",
815830
"exclude=", "include=", "package=", "strip", "iconfile=",
816-
"lib=", "python=", "semi-standalone")
831+
"lib=", "python=", "semi-standalone", "bundle-id=")
817832

818833
try:
819834
options, args = getopt.getopt(sys.argv[1:], shortopts, longopts)
@@ -841,6 +856,8 @@ def main(builder=None):
841856
builder.argv_emulation = 1
842857
elif opt in ('-c', '--creator'):
843858
builder.creator = arg
859+
elif opt == '--bundle-id':
860+
builder.bundle_id = arg
844861
elif opt == '--iconfile':
845862
builder.iconfile = arg
846863
elif opt == "--lib":

0 commit comments

Comments
 (0)