Keep symlinks when copying into .app bundle

Code signing failed for me on OSX 10.9.5 because the
Versions/Current symbolic links were being replaced
with a duplicate copy of the frameworks' code.

Releases were bigger than they needed to be, for the
same reason.
This commit is contained in:
Gavin Andresen 2014-09-29 12:09:46 -04:00
parent 1fbccda8d0
commit 965c306d6d
No known key found for this signature in database
GPG Key ID: 7588242FBE38D3A8

View File

@ -292,7 +292,7 @@ def copyFramework(framework, path, verbose):
fromResourcesDir = framework.sourceResourcesDirectory fromResourcesDir = framework.sourceResourcesDirectory
if os.path.exists(fromResourcesDir): if os.path.exists(fromResourcesDir):
toResourcesDir = os.path.join(path, framework.destinationResourcesDirectory) toResourcesDir = os.path.join(path, framework.destinationResourcesDirectory)
shutil.copytree(fromResourcesDir, toResourcesDir) shutil.copytree(fromResourcesDir, toResourcesDir, symlinks=True)
if verbose >= 3: if verbose >= 3:
print "Copied resources:", fromResourcesDir print "Copied resources:", fromResourcesDir
print " to:", toResourcesDir print " to:", toResourcesDir
@ -301,7 +301,7 @@ def copyFramework(framework, path, verbose):
fromContentsDir = framework.sourceContentsDirectory fromContentsDir = framework.sourceContentsDirectory
if os.path.exists(fromContentsDir): if os.path.exists(fromContentsDir):
toContentsDir = os.path.join(path, framework.destinationVersionContentsDirectory) toContentsDir = os.path.join(path, framework.destinationVersionContentsDirectory)
shutil.copytree(fromContentsDir, toContentsDir) shutil.copytree(fromContentsDir, toContentsDir, symlinks=True)
contentslinkfrom = os.path.join(path, framework.destinationContentsDirectory) contentslinkfrom = os.path.join(path, framework.destinationContentsDirectory)
if verbose >= 3: if verbose >= 3:
print "Copied Contents:", fromContentsDir print "Copied Contents:", fromContentsDir
@ -310,7 +310,7 @@ def copyFramework(framework, path, verbose):
qtMenuNibSourcePath = os.path.join(framework.frameworkDirectory, "Resources", "qt_menu.nib") qtMenuNibSourcePath = os.path.join(framework.frameworkDirectory, "Resources", "qt_menu.nib")
qtMenuNibDestinationPath = os.path.join(path, "Contents", "Resources", "qt_menu.nib") qtMenuNibDestinationPath = os.path.join(path, "Contents", "Resources", "qt_menu.nib")
if os.path.exists(qtMenuNibSourcePath) and not os.path.exists(qtMenuNibDestinationPath): if os.path.exists(qtMenuNibSourcePath) and not os.path.exists(qtMenuNibDestinationPath):
shutil.copytree(qtMenuNibSourcePath, qtMenuNibDestinationPath) shutil.copytree(qtMenuNibSourcePath, qtMenuNibDestinationPath, symlinks=True)
if verbose >= 3: if verbose >= 3:
print "Copied for libQtGui:", qtMenuNibSourcePath print "Copied for libQtGui:", qtMenuNibSourcePath
print " to:", qtMenuNibDestinationPath print " to:", qtMenuNibDestinationPath
@ -584,7 +584,7 @@ if verbose >= 3:
print app_bundle, "->", target print app_bundle, "->", target
os.mkdir("dist") os.mkdir("dist")
shutil.copytree(app_bundle, target) shutil.copytree(app_bundle, target, symlinks=True)
applicationBundle = ApplicationBundleInfo(target) applicationBundle = ApplicationBundleInfo(target)
@ -671,7 +671,7 @@ for p in config.add_resources:
if verbose >= 3: if verbose >= 3:
print p, "->", t print p, "->", t
if os.path.isdir(p): if os.path.isdir(p):
shutil.copytree(p, t) shutil.copytree(p, t, symlinks=True)
else: else:
shutil.copy2(p, t) shutil.copy2(p, t)