From 15624d850b65a0be8e944e9f17849799e3e7ede5 Mon Sep 17 00:00:00 2001 From: Just van Rossum Date: Fri, 21 Mar 2003 09:26:59 +0000 Subject: Patch #681927 from Robin Dunn: add option to add shared libraries or frameworks to the bundle. --- Lib/plat-mac/bundlebuilder.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Lib/plat-mac/bundlebuilder.py b/Lib/plat-mac/bundlebuilder.py index 5fe2c60..2a32499 100755 --- a/Lib/plat-mac/bundlebuilder.py +++ b/Lib/plat-mac/bundlebuilder.py @@ -94,6 +94,10 @@ class BundleBuilder(Defaults): # (eg. "Contents/Resources/MyStuff/SomeFile.ext). files = [] + # List of shared libraries (dylibs, Frameworks) to bundle with the app + # will be placed in Contents/Frameworks + libs = [] + # Directory where the bundle will be assembled. builddir = "build" @@ -168,6 +172,9 @@ class BundleBuilder(Defaults): for path in self.resources: files.append((path, pathjoin("Contents", "Resources", os.path.basename(path)))) + for path in self.libs: + files.append((path, pathjoin("Contents", "Frameworks", + os.path.basename(path)))) if self.symlink: self.message("Making symbolic links", 1) msg = "Making symlink from" @@ -268,12 +275,14 @@ import sys, os execdir = os.path.dirname(sys.argv[0]) executable = os.path.join(execdir, "%(executable)s") resdir = os.path.join(os.path.dirname(execdir), "Resources") +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 os.environ["PYTHONHOME"] = resdir os.environ["PYTHONEXECUTABLE"] = executable +os.environ["DYLD_LIBRARY_PATH"] = libdir os.execve(executable, sys.argv, os.environ) """ @@ -697,6 +706,8 @@ Options: --link-exec symlink the executable instead of copying it --standalone build a standalone application, which is fully independent of a Python installation + --lib=FILE shared library or framework to be copied into + the bundle -x, --exclude=MODULE exclude module (with --standalone) -i, --include=MODULE include module (with --standalone) --package=PACKAGE include a whole package (with --standalone) @@ -720,7 +731,8 @@ def main(builder=None): longopts = ("builddir=", "name=", "resource=", "file=", "executable=", "mainprogram=", "creator=", "nib=", "plist=", "link", "link-exec", "help", "verbose", "quiet", "argv", "standalone", - "exclude=", "include=", "package=", "strip", "iconfile=") + "exclude=", "include=", "package=", "strip", "iconfile=", + "lib=") try: options, args = getopt.getopt(sys.argv[1:], shortopts, longopts) @@ -750,6 +762,8 @@ def main(builder=None): builder.creator = arg elif opt == '--iconfile': builder.iconfile = arg + elif opt == "--lib": + builder.libs.append(arg) elif opt == "--nib": builder.nibname = arg elif opt in ('-p', '--plist'): -- cgit v0.12