summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJust van Rossum <just@letterror.com>2002-11-22 11:43:10 (GMT)
committerJust van Rossum <just@letterror.com>2002-11-22 11:43:10 (GMT)
commit16aebf77c7825c66b54f289ec273a66713346b69 (patch)
treedd254b996933409baeb632def024720d7550d273 /Mac
parent224405fcfd863017b5b96c37d24251060c5683e5 (diff)
downloadcpython-16aebf77c7825c66b54f289ec273a66713346b69.zip
cpython-16aebf77c7825c66b54f289ec273a66713346b69.tar.gz
cpython-16aebf77c7825c66b54f289ec273a66713346b69.tar.bz2
Added --link-exec option: make a symlink for the executable only, copy all other files.
Diffstat (limited to 'Mac')
-rwxr-xr-xMac/Lib/bundlebuilder.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/Mac/Lib/bundlebuilder.py b/Mac/Lib/bundlebuilder.py
index 7854770..1503f2b 100755
--- a/Mac/Lib/bundlebuilder.py
+++ b/Mac/Lib/bundlebuilder.py
@@ -212,16 +212,18 @@ class AppBuilder(BundleBuilder):
it will simply be used as the main executable.
nibname: The name of the main nib, for Cocoa apps. Defaults
to None, but must be specified when building a Cocoa app.
+ symlink_exec: Symlink the executable instead of copying it.
For the other keyword arguments see the BundleBuilder doc string.
"""
def __init__(self, name=None, mainprogram=None, executable=None,
- nibname=None, **kwargs):
+ nibname=None, symlink_exec=0, **kwargs):
"""See the class doc string for a description of the arguments."""
self.mainprogram = mainprogram
self.executable = executable
self.nibname = nibname
+ self.symlink_exec = symlink_exec
BundleBuilder.__init__(self, name=name, **kwargs)
def setup(self):
@@ -254,7 +256,10 @@ class AppBuilder(BundleBuilder):
execpath = pathjoin(self.execdir, self.name)
else:
execpath = pathjoin(resdir, os.path.basename(self.executable))
- self.files.append((self.executable, execpath))
+ if not self.symlink_exec:
+ self.files.append((self.executable, execpath))
+ else:
+ self.execpath = execpath
# For execve wrapper
setexecutable = setExecutableTemplate % os.path.basename(self.executable)
else:
@@ -272,6 +277,14 @@ class AppBuilder(BundleBuilder):
open(mainwrapperpath, "w").write(mainWrapperTemplate % locals())
os.chmod(mainwrapperpath, 0777)
+ def postProcess(self):
+ if self.symlink_exec and self.executable:
+ self.message("Symlinking executable %s to %s" % (self.executable,
+ self.execpath), 2)
+ dst = pathjoin(self.bundlepath, self.execpath)
+ makedirs(os.path.dirname(dst))
+ os.symlink(os.path.abspath(self.executable), dst)
+
def copy(src, dst, mkdirs=0):
"""Copy a file or a directory."""
@@ -329,6 +342,7 @@ Options:
--nib=NAME main nib name
-c, --creator=CCCC 4-char creator code (default: '????')
-l, --link symlink files/folder instead of copying them
+ --link-exec symlink the executable instead of copying it
-v, --verbose increase verbosity level
-q, --quiet decrease verbosity level
-h, --help print this message
@@ -346,8 +360,8 @@ def main(builder=None):
shortopts = "b:n:r:e:m:c:plhvq"
longopts = ("builddir=", "name=", "resource=", "executable=",
- "mainprogram=", "creator=", "nib=", "plist=", "link", "help",
- "verbose", "quiet")
+ "mainprogram=", "creator=", "nib=", "plist=", "link",
+ "link-exec", "help", "verbose", "quiet")
try:
options, args = getopt.getopt(sys.argv[1:], shortopts, longopts)
@@ -373,6 +387,8 @@ def main(builder=None):
builder.plist = Plist.fromFile(arg)
elif opt in ('-l', '--link'):
builder.symlink = 1
+ elif opt == '--link-exec':
+ builder.symlink_exec = 1
elif opt in ('-h', '--help'):
usage()
elif opt in ('-v', '--verbose'):