|
|
@ -1,5 +1,5 @@ |
|
|
|
#!/usr/bin/env python |
|
|
|
#!/usr/bin/env python |
|
|
|
|
|
|
|
from __future__ import division, print_function, unicode_literals |
|
|
|
# |
|
|
|
# |
|
|
|
# Copyright (C) 2011 Patrick "p2k" Schneider <me@p2k-network.org> |
|
|
|
# Copyright (C) 2011 Patrick "p2k" Schneider <me@p2k-network.org> |
|
|
|
# |
|
|
|
# |
|
|
@ -201,7 +201,7 @@ class DeploymentInfo(object): |
|
|
|
|
|
|
|
|
|
|
|
def getFrameworks(binaryPath, verbose): |
|
|
|
def getFrameworks(binaryPath, verbose): |
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print "Inspecting with otool: " + binaryPath |
|
|
|
print("Inspecting with otool: " + binaryPath) |
|
|
|
otoolbin=os.getenv("OTOOL", "otool") |
|
|
|
otoolbin=os.getenv("OTOOL", "otool") |
|
|
|
otool = subprocess.Popen([otoolbin, "-L", binaryPath], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
|
|
|
otool = subprocess.Popen([otoolbin, "-L", binaryPath], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
|
|
|
o_stdout, o_stderr = otool.communicate() |
|
|
|
o_stdout, o_stderr = otool.communicate() |
|
|
@ -222,8 +222,8 @@ def getFrameworks(binaryPath, verbose): |
|
|
|
info = FrameworkInfo.fromOtoolLibraryLine(line.strip()) |
|
|
|
info = FrameworkInfo.fromOtoolLibraryLine(line.strip()) |
|
|
|
if info is not None: |
|
|
|
if info is not None: |
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print "Found framework:" |
|
|
|
print("Found framework:") |
|
|
|
print info |
|
|
|
print(info) |
|
|
|
libraries.append(info) |
|
|
|
libraries.append(info) |
|
|
|
|
|
|
|
|
|
|
|
return libraries |
|
|
|
return libraries |
|
|
@ -234,24 +234,24 @@ def runInstallNameTool(action, *args): |
|
|
|
|
|
|
|
|
|
|
|
def changeInstallName(oldName, newName, binaryPath, verbose): |
|
|
|
def changeInstallName(oldName, newName, binaryPath, verbose): |
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print "Using install_name_tool:" |
|
|
|
print("Using install_name_tool:") |
|
|
|
print " in", binaryPath |
|
|
|
print(" in", binaryPath) |
|
|
|
print " change reference", oldName |
|
|
|
print(" change reference", oldName) |
|
|
|
print " to", newName |
|
|
|
print(" to", newName) |
|
|
|
runInstallNameTool("change", oldName, newName, binaryPath) |
|
|
|
runInstallNameTool("change", oldName, newName, binaryPath) |
|
|
|
|
|
|
|
|
|
|
|
def changeIdentification(id, binaryPath, verbose): |
|
|
|
def changeIdentification(id, binaryPath, verbose): |
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print "Using install_name_tool:" |
|
|
|
print("Using install_name_tool:") |
|
|
|
print " change identification in", binaryPath |
|
|
|
print(" change identification in", binaryPath) |
|
|
|
print " to", id |
|
|
|
print(" to", id) |
|
|
|
runInstallNameTool("id", id, binaryPath) |
|
|
|
runInstallNameTool("id", id, binaryPath) |
|
|
|
|
|
|
|
|
|
|
|
def runStrip(binaryPath, verbose): |
|
|
|
def runStrip(binaryPath, verbose): |
|
|
|
stripbin=os.getenv("STRIP", "strip") |
|
|
|
stripbin=os.getenv("STRIP", "strip") |
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print "Using strip:" |
|
|
|
print("Using strip:") |
|
|
|
print " stripped", binaryPath |
|
|
|
print(" stripped", binaryPath) |
|
|
|
subprocess.check_call([stripbin, "-x", binaryPath]) |
|
|
|
subprocess.check_call([stripbin, "-x", binaryPath]) |
|
|
|
|
|
|
|
|
|
|
|
def copyFramework(framework, path, verbose): |
|
|
|
def copyFramework(framework, path, verbose): |
|
|
@ -274,8 +274,8 @@ def copyFramework(framework, path, verbose): |
|
|
|
|
|
|
|
|
|
|
|
shutil.copy2(fromPath, toPath) |
|
|
|
shutil.copy2(fromPath, toPath) |
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print "Copied:", fromPath |
|
|
|
print("Copied:", fromPath) |
|
|
|
print " to:", toPath |
|
|
|
print(" to:", toPath) |
|
|
|
|
|
|
|
|
|
|
|
permissions = os.stat(toPath) |
|
|
|
permissions = os.stat(toPath) |
|
|
|
if not permissions.st_mode & stat.S_IWRITE: |
|
|
|
if not permissions.st_mode & stat.S_IWRITE: |
|
|
@ -288,14 +288,14 @@ def copyFramework(framework, path, verbose): |
|
|
|
if not os.path.exists(linkfrom): |
|
|
|
if not os.path.exists(linkfrom): |
|
|
|
os.symlink(linkto, linkfrom) |
|
|
|
os.symlink(linkto, linkfrom) |
|
|
|
if verbose >= 2: |
|
|
|
if verbose >= 2: |
|
|
|
print "Linked:", linkfrom, "->", linkto |
|
|
|
print("Linked:", linkfrom, "->", linkto) |
|
|
|
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, symlinks=True) |
|
|
|
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) |
|
|
|
fromContentsDir = framework.sourceVersionContentsDirectory |
|
|
|
fromContentsDir = framework.sourceVersionContentsDirectory |
|
|
|
if not os.path.exists(fromContentsDir): |
|
|
|
if not os.path.exists(fromContentsDir): |
|
|
|
fromContentsDir = framework.sourceContentsDirectory |
|
|
|
fromContentsDir = framework.sourceContentsDirectory |
|
|
@ -304,16 +304,16 @@ def copyFramework(framework, path, verbose): |
|
|
|
shutil.copytree(fromContentsDir, toContentsDir, symlinks=True) |
|
|
|
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) |
|
|
|
print " to:", toContentsDir |
|
|
|
print(" to:", toContentsDir) |
|
|
|
elif framework.frameworkName.startswith("libQtGui"): # Copy qt_menu.nib (applies to non-framework layout) |
|
|
|
elif framework.frameworkName.startswith("libQtGui"): # Copy qt_menu.nib (applies to non-framework layout) |
|
|
|
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, symlinks=True) |
|
|
|
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) |
|
|
|
|
|
|
|
|
|
|
|
return toPath |
|
|
|
return toPath |
|
|
|
|
|
|
|
|
|
|
@ -326,7 +326,7 @@ def deployFrameworks(frameworks, bundlePath, binaryPath, strip, verbose, deploym |
|
|
|
deploymentInfo.deployedFrameworks.append(framework.frameworkName) |
|
|
|
deploymentInfo.deployedFrameworks.append(framework.frameworkName) |
|
|
|
|
|
|
|
|
|
|
|
if verbose >= 2: |
|
|
|
if verbose >= 2: |
|
|
|
print "Processing", framework.frameworkName, "..." |
|
|
|
print("Processing", framework.frameworkName, "...") |
|
|
|
|
|
|
|
|
|
|
|
# Get the Qt path from one of the Qt frameworks |
|
|
|
# Get the Qt path from one of the Qt frameworks |
|
|
|
if deploymentInfo.qtPath is None and framework.isQtFramework(): |
|
|
|
if deploymentInfo.qtPath is None and framework.isQtFramework(): |
|
|
@ -334,7 +334,7 @@ def deployFrameworks(frameworks, bundlePath, binaryPath, strip, verbose, deploym |
|
|
|
|
|
|
|
|
|
|
|
if framework.installName.startswith("@executable_path") or framework.installName.startswith(bundlePath): |
|
|
|
if framework.installName.startswith("@executable_path") or framework.installName.startswith(bundlePath): |
|
|
|
if verbose >= 2: |
|
|
|
if verbose >= 2: |
|
|
|
print framework.frameworkName, "already deployed, skipping." |
|
|
|
print(framework.frameworkName, "already deployed, skipping.") |
|
|
|
continue |
|
|
|
continue |
|
|
|
|
|
|
|
|
|
|
|
# install_name_tool the new id into the binary |
|
|
|
# install_name_tool the new id into the binary |
|
|
@ -366,7 +366,7 @@ def deployFrameworks(frameworks, bundlePath, binaryPath, strip, verbose, deploym |
|
|
|
def deployFrameworksForAppBundle(applicationBundle, strip, verbose): |
|
|
|
def deployFrameworksForAppBundle(applicationBundle, strip, verbose): |
|
|
|
frameworks = getFrameworks(applicationBundle.binaryPath, verbose) |
|
|
|
frameworks = getFrameworks(applicationBundle.binaryPath, verbose) |
|
|
|
if len(frameworks) == 0 and verbose >= 1: |
|
|
|
if len(frameworks) == 0 and verbose >= 1: |
|
|
|
print "Warning: Could not find any external frameworks to deploy in %s." % (applicationBundle.path) |
|
|
|
print("Warning: Could not find any external frameworks to deploy in %s." % (applicationBundle.path)) |
|
|
|
return DeploymentInfo() |
|
|
|
return DeploymentInfo() |
|
|
|
else: |
|
|
|
else: |
|
|
|
return deployFrameworks(frameworks, applicationBundle.path, applicationBundle.binaryPath, strip, verbose) |
|
|
|
return deployFrameworks(frameworks, applicationBundle.path, applicationBundle.binaryPath, strip, verbose) |
|
|
@ -444,7 +444,7 @@ def deployPlugins(appBundleInfo, deploymentInfo, strip, verbose): |
|
|
|
|
|
|
|
|
|
|
|
for pluginDirectory, pluginName in plugins: |
|
|
|
for pluginDirectory, pluginName in plugins: |
|
|
|
if verbose >= 2: |
|
|
|
if verbose >= 2: |
|
|
|
print "Processing plugin", os.path.join(pluginDirectory, pluginName), "..." |
|
|
|
print("Processing plugin", os.path.join(pluginDirectory, pluginName), "...") |
|
|
|
|
|
|
|
|
|
|
|
sourcePath = os.path.join(deploymentInfo.pluginPath, pluginDirectory, pluginName) |
|
|
|
sourcePath = os.path.join(deploymentInfo.pluginPath, pluginDirectory, pluginName) |
|
|
|
destinationDirectory = os.path.join(appBundleInfo.pluginPath, pluginDirectory) |
|
|
|
destinationDirectory = os.path.join(appBundleInfo.pluginPath, pluginDirectory) |
|
|
@ -454,8 +454,8 @@ def deployPlugins(appBundleInfo, deploymentInfo, strip, verbose): |
|
|
|
destinationPath = os.path.join(destinationDirectory, pluginName) |
|
|
|
destinationPath = os.path.join(destinationDirectory, pluginName) |
|
|
|
shutil.copy2(sourcePath, destinationPath) |
|
|
|
shutil.copy2(sourcePath, destinationPath) |
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print "Copied:", sourcePath |
|
|
|
print("Copied:", sourcePath) |
|
|
|
print " to:", destinationPath |
|
|
|
print(" to:", destinationPath) |
|
|
|
|
|
|
|
|
|
|
|
if strip: |
|
|
|
if strip: |
|
|
|
runStrip(destinationPath, verbose) |
|
|
|
runStrip(destinationPath, verbose) |
|
|
@ -525,7 +525,7 @@ if config.translations_dir and config.translations_dir[0]: |
|
|
|
|
|
|
|
|
|
|
|
for p in config.add_resources: |
|
|
|
for p in config.add_resources: |
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print "Checking for \"%s\"..." % p |
|
|
|
print("Checking for \"%s\"..." % p) |
|
|
|
if not os.path.exists(p): |
|
|
|
if not os.path.exists(p): |
|
|
|
if verbose >= 1: |
|
|
|
if verbose >= 1: |
|
|
|
sys.stderr.write("Error: Could not find additional resource file \"%s\"\n" % (p)) |
|
|
|
sys.stderr.write("Error: Could not find additional resource file \"%s\"\n" % (p)) |
|
|
@ -535,7 +535,7 @@ for p in config.add_resources: |
|
|
|
|
|
|
|
|
|
|
|
if len(config.fancy) == 1: |
|
|
|
if len(config.fancy) == 1: |
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print "Fancy: Importing plistlib..." |
|
|
|
print("Fancy: Importing plistlib...") |
|
|
|
try: |
|
|
|
try: |
|
|
|
import plistlib |
|
|
|
import plistlib |
|
|
|
except ImportError: |
|
|
|
except ImportError: |
|
|
@ -545,7 +545,7 @@ if len(config.fancy) == 1: |
|
|
|
|
|
|
|
|
|
|
|
p = config.fancy[0] |
|
|
|
p = config.fancy[0] |
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print "Fancy: Loading \"%s\"..." % p |
|
|
|
print("Fancy: Loading \"%s\"..." % p) |
|
|
|
if not os.path.exists(p): |
|
|
|
if not os.path.exists(p): |
|
|
|
if verbose >= 1: |
|
|
|
if verbose >= 1: |
|
|
|
sys.stderr.write("Error: Could not find fancy disk image plist at \"%s\"\n" % (p)) |
|
|
|
sys.stderr.write("Error: Could not find fancy disk image plist at \"%s\"\n" % (p)) |
|
|
@ -559,23 +559,23 @@ if len(config.fancy) == 1: |
|
|
|
sys.exit(1) |
|
|
|
sys.exit(1) |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
assert not fancy.has_key("window_bounds") or (isinstance(fancy["window_bounds"], list) and len(fancy["window_bounds"]) == 4) |
|
|
|
assert "window_bounds" not in fancy or (isinstance(fancy["window_bounds"], list) and len(fancy["window_bounds"]) == 4) |
|
|
|
assert not fancy.has_key("background_picture") or isinstance(fancy["background_picture"], str) |
|
|
|
assert "background_picture" not in fancy or isinstance(fancy["background_picture"], str) |
|
|
|
assert not fancy.has_key("icon_size") or isinstance(fancy["icon_size"], int) |
|
|
|
assert "icon_size" not in fancy or isinstance(fancy["icon_size"], int) |
|
|
|
assert not fancy.has_key("applications_symlink") or isinstance(fancy["applications_symlink"], bool) |
|
|
|
assert "applications_symlink" not in fancy or isinstance(fancy["applications_symlink"], bool) |
|
|
|
if fancy.has_key("items_position"): |
|
|
|
if "items_position" in fancy: |
|
|
|
assert isinstance(fancy["items_position"], dict) |
|
|
|
assert isinstance(fancy["items_position"], dict) |
|
|
|
for key, value in fancy["items_position"].iteritems(): |
|
|
|
for key, value in fancy["items_position"].items(): |
|
|
|
assert isinstance(value, list) and len(value) == 2 and isinstance(value[0], int) and isinstance(value[1], int) |
|
|
|
assert isinstance(value, list) and len(value) == 2 and isinstance(value[0], int) and isinstance(value[1], int) |
|
|
|
except: |
|
|
|
except: |
|
|
|
if verbose >= 1: |
|
|
|
if verbose >= 1: |
|
|
|
sys.stderr.write("Error: Bad format of fancy disk image plist at \"%s\"\n" % (p)) |
|
|
|
sys.stderr.write("Error: Bad format of fancy disk image plist at \"%s\"\n" % (p)) |
|
|
|
sys.exit(1) |
|
|
|
sys.exit(1) |
|
|
|
|
|
|
|
|
|
|
|
if fancy.has_key("background_picture"): |
|
|
|
if "background_picture" in fancy: |
|
|
|
bp = fancy["background_picture"] |
|
|
|
bp = fancy["background_picture"] |
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print "Fancy: Resolving background picture \"%s\"..." % bp |
|
|
|
print("Fancy: Resolving background picture \"%s\"..." % bp) |
|
|
|
if not os.path.exists(bp): |
|
|
|
if not os.path.exists(bp): |
|
|
|
bp = os.path.join(os.path.dirname(p), bp) |
|
|
|
bp = os.path.join(os.path.dirname(p), bp) |
|
|
|
if not os.path.exists(bp): |
|
|
|
if not os.path.exists(bp): |
|
|
@ -591,7 +591,7 @@ else: |
|
|
|
|
|
|
|
|
|
|
|
if os.path.exists("dist"): |
|
|
|
if os.path.exists("dist"): |
|
|
|
if verbose >= 2: |
|
|
|
if verbose >= 2: |
|
|
|
print "+ Removing old dist folder +" |
|
|
|
print("+ Removing old dist folder +") |
|
|
|
|
|
|
|
|
|
|
|
shutil.rmtree("dist") |
|
|
|
shutil.rmtree("dist") |
|
|
|
|
|
|
|
|
|
|
@ -607,9 +607,9 @@ else: |
|
|
|
target = os.path.join("dist", "Bitcoin-Qt.app") |
|
|
|
target = os.path.join("dist", "Bitcoin-Qt.app") |
|
|
|
|
|
|
|
|
|
|
|
if verbose >= 2: |
|
|
|
if verbose >= 2: |
|
|
|
print "+ Copying source bundle +" |
|
|
|
print("+ Copying source bundle +") |
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print app_bundle, "->", target |
|
|
|
print(app_bundle, "->", target) |
|
|
|
|
|
|
|
|
|
|
|
os.mkdir("dist") |
|
|
|
os.mkdir("dist") |
|
|
|
shutil.copytree(app_bundle, target, symlinks=True) |
|
|
|
shutil.copytree(app_bundle, target, symlinks=True) |
|
|
@ -619,7 +619,7 @@ applicationBundle = ApplicationBundleInfo(target) |
|
|
|
# ------------------------------------------------ |
|
|
|
# ------------------------------------------------ |
|
|
|
|
|
|
|
|
|
|
|
if verbose >= 2: |
|
|
|
if verbose >= 2: |
|
|
|
print "+ Deploying frameworks +" |
|
|
|
print("+ Deploying frameworks +") |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
deploymentInfo = deployFrameworksForAppBundle(applicationBundle, config.strip, verbose) |
|
|
|
deploymentInfo = deployFrameworksForAppBundle(applicationBundle, config.strip, verbose) |
|
|
@ -638,7 +638,7 @@ except RuntimeError as e: |
|
|
|
|
|
|
|
|
|
|
|
if config.plugins: |
|
|
|
if config.plugins: |
|
|
|
if verbose >= 2: |
|
|
|
if verbose >= 2: |
|
|
|
print "+ Deploying plugins +" |
|
|
|
print("+ Deploying plugins +") |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
deployPlugins(applicationBundle, deploymentInfo, config.strip, verbose) |
|
|
|
deployPlugins(applicationBundle, deploymentInfo, config.strip, verbose) |
|
|
@ -664,7 +664,7 @@ else: |
|
|
|
for lng_file in add_qt_tr: |
|
|
|
for lng_file in add_qt_tr: |
|
|
|
p = os.path.join(qt_tr_dir, lng_file) |
|
|
|
p = os.path.join(qt_tr_dir, lng_file) |
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print "Checking for \"%s\"..." % p |
|
|
|
print("Checking for \"%s\"..." % p) |
|
|
|
if not os.path.exists(p): |
|
|
|
if not os.path.exists(p): |
|
|
|
if verbose >= 1: |
|
|
|
if verbose >= 1: |
|
|
|
sys.stderr.write("Error: Could not find Qt translation file \"%s\"\n" % (lng_file)) |
|
|
|
sys.stderr.write("Error: Could not find Qt translation file \"%s\"\n" % (lng_file)) |
|
|
@ -673,7 +673,7 @@ else: |
|
|
|
# ------------------------------------------------ |
|
|
|
# ------------------------------------------------ |
|
|
|
|
|
|
|
|
|
|
|
if verbose >= 2: |
|
|
|
if verbose >= 2: |
|
|
|
print "+ Installing qt.conf +" |
|
|
|
print("+ Installing qt.conf +") |
|
|
|
|
|
|
|
|
|
|
|
f = open(os.path.join(applicationBundle.resourcesPath, "qt.conf"), "wb") |
|
|
|
f = open(os.path.join(applicationBundle.resourcesPath, "qt.conf"), "wb") |
|
|
|
f.write(qt_conf) |
|
|
|
f.write(qt_conf) |
|
|
@ -682,22 +682,22 @@ f.close() |
|
|
|
# ------------------------------------------------ |
|
|
|
# ------------------------------------------------ |
|
|
|
|
|
|
|
|
|
|
|
if len(add_qt_tr) > 0 and verbose >= 2: |
|
|
|
if len(add_qt_tr) > 0 and verbose >= 2: |
|
|
|
print "+ Adding Qt translations +" |
|
|
|
print("+ Adding Qt translations +") |
|
|
|
|
|
|
|
|
|
|
|
for lng_file in add_qt_tr: |
|
|
|
for lng_file in add_qt_tr: |
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print os.path.join(qt_tr_dir, lng_file), "->", os.path.join(applicationBundle.resourcesPath, lng_file) |
|
|
|
print(os.path.join(qt_tr_dir, lng_file), "->", os.path.join(applicationBundle.resourcesPath, lng_file)) |
|
|
|
shutil.copy2(os.path.join(qt_tr_dir, lng_file), os.path.join(applicationBundle.resourcesPath, lng_file)) |
|
|
|
shutil.copy2(os.path.join(qt_tr_dir, lng_file), os.path.join(applicationBundle.resourcesPath, lng_file)) |
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------ |
|
|
|
# ------------------------------------------------ |
|
|
|
|
|
|
|
|
|
|
|
if len(config.add_resources) > 0 and verbose >= 2: |
|
|
|
if len(config.add_resources) > 0 and verbose >= 2: |
|
|
|
print "+ Adding additional resources +" |
|
|
|
print("+ Adding additional resources +") |
|
|
|
|
|
|
|
|
|
|
|
for p in config.add_resources: |
|
|
|
for p in config.add_resources: |
|
|
|
t = os.path.join(applicationBundle.resourcesPath, os.path.basename(p)) |
|
|
|
t = os.path.join(applicationBundle.resourcesPath, os.path.basename(p)) |
|
|
|
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, symlinks=True) |
|
|
|
shutil.copytree(p, t, symlinks=True) |
|
|
|
else: |
|
|
|
else: |
|
|
@ -706,10 +706,10 @@ for p in config.add_resources: |
|
|
|
# ------------------------------------------------ |
|
|
|
# ------------------------------------------------ |
|
|
|
|
|
|
|
|
|
|
|
if config.sign and 'CODESIGNARGS' not in os.environ: |
|
|
|
if config.sign and 'CODESIGNARGS' not in os.environ: |
|
|
|
print "You must set the CODESIGNARGS environment variable. Skipping signing." |
|
|
|
print("You must set the CODESIGNARGS environment variable. Skipping signing.") |
|
|
|
elif config.sign: |
|
|
|
elif config.sign: |
|
|
|
if verbose >= 1: |
|
|
|
if verbose >= 1: |
|
|
|
print "Code-signing app bundle %s"%(target,) |
|
|
|
print("Code-signing app bundle %s"%(target,)) |
|
|
|
subprocess.check_call("codesign --force %s %s"%(os.environ['CODESIGNARGS'], target), shell=True) |
|
|
|
subprocess.check_call("codesign --force %s %s"%(os.environ['CODESIGNARGS'], target), shell=True) |
|
|
|
|
|
|
|
|
|
|
|
# ------------------------------------------------ |
|
|
|
# ------------------------------------------------ |
|
|
@ -734,7 +734,7 @@ if config.dmg is not None: |
|
|
|
|
|
|
|
|
|
|
|
def runHDIUtil(verb, image_basename, **kwargs): |
|
|
|
def runHDIUtil(verb, image_basename, **kwargs): |
|
|
|
hdiutil_args = ["hdiutil", verb, image_basename + ".dmg"] |
|
|
|
hdiutil_args = ["hdiutil", verb, image_basename + ".dmg"] |
|
|
|
if kwargs.has_key("capture_stdout"): |
|
|
|
if "capture_stdout" in kwargs: |
|
|
|
del kwargs["capture_stdout"] |
|
|
|
del kwargs["capture_stdout"] |
|
|
|
run = subprocess.check_output |
|
|
|
run = subprocess.check_output |
|
|
|
else: |
|
|
|
else: |
|
|
@ -744,7 +744,7 @@ if config.dmg is not None: |
|
|
|
hdiutil_args.append("-verbose") |
|
|
|
hdiutil_args.append("-verbose") |
|
|
|
run = subprocess.check_call |
|
|
|
run = subprocess.check_call |
|
|
|
|
|
|
|
|
|
|
|
for key, value in kwargs.iteritems(): |
|
|
|
for key, value in kwargs.items(): |
|
|
|
hdiutil_args.append("-" + key) |
|
|
|
hdiutil_args.append("-" + key) |
|
|
|
if not value is True: |
|
|
|
if not value is True: |
|
|
|
hdiutil_args.append(str(value)) |
|
|
|
hdiutil_args.append(str(value)) |
|
|
@ -753,9 +753,9 @@ if config.dmg is not None: |
|
|
|
|
|
|
|
|
|
|
|
if verbose >= 2: |
|
|
|
if verbose >= 2: |
|
|
|
if fancy is None: |
|
|
|
if fancy is None: |
|
|
|
print "+ Creating .dmg disk image +" |
|
|
|
print("+ Creating .dmg disk image +") |
|
|
|
else: |
|
|
|
else: |
|
|
|
print "+ Preparing .dmg disk image +" |
|
|
|
print("+ Preparing .dmg disk image +") |
|
|
|
|
|
|
|
|
|
|
|
if config.dmg != "": |
|
|
|
if config.dmg != "": |
|
|
|
dmg_name = config.dmg |
|
|
|
dmg_name = config.dmg |
|
|
@ -770,7 +770,7 @@ if config.dmg is not None: |
|
|
|
sys.exit(e.returncode) |
|
|
|
sys.exit(e.returncode) |
|
|
|
else: |
|
|
|
else: |
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print "Determining size of \"dist\"..." |
|
|
|
print("Determining size of \"dist\"...") |
|
|
|
size = 0 |
|
|
|
size = 0 |
|
|
|
for path, dirs, files in os.walk("dist"): |
|
|
|
for path, dirs, files in os.walk("dist"): |
|
|
|
for file in files: |
|
|
|
for file in files: |
|
|
@ -778,14 +778,14 @@ if config.dmg is not None: |
|
|
|
size += int(size * 0.15) |
|
|
|
size += int(size * 0.15) |
|
|
|
|
|
|
|
|
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print "Creating temp image for modification..." |
|
|
|
print("Creating temp image for modification...") |
|
|
|
try: |
|
|
|
try: |
|
|
|
runHDIUtil("create", dmg_name + ".temp", srcfolder="dist", format="UDRW", size=size, volname=volname, ov=True) |
|
|
|
runHDIUtil("create", dmg_name + ".temp", srcfolder="dist", format="UDRW", size=size, volname=volname, ov=True) |
|
|
|
except subprocess.CalledProcessError as e: |
|
|
|
except subprocess.CalledProcessError as e: |
|
|
|
sys.exit(e.returncode) |
|
|
|
sys.exit(e.returncode) |
|
|
|
|
|
|
|
|
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print "Attaching temp image..." |
|
|
|
print("Attaching temp image...") |
|
|
|
try: |
|
|
|
try: |
|
|
|
output = runHDIUtil("attach", dmg_name + ".temp", readwrite=True, noverify=True, noautoopen=True, capture_stdout=True) |
|
|
|
output = runHDIUtil("attach", dmg_name + ".temp", readwrite=True, noverify=True, noautoopen=True, capture_stdout=True) |
|
|
|
except subprocess.CalledProcessError as e: |
|
|
|
except subprocess.CalledProcessError as e: |
|
|
@ -796,13 +796,13 @@ if config.dmg is not None: |
|
|
|
disk_name = m.group(1) |
|
|
|
disk_name = m.group(1) |
|
|
|
|
|
|
|
|
|
|
|
if verbose >= 2: |
|
|
|
if verbose >= 2: |
|
|
|
print "+ Applying fancy settings +" |
|
|
|
print("+ Applying fancy settings +") |
|
|
|
|
|
|
|
|
|
|
|
if fancy.has_key("background_picture"): |
|
|
|
if "background_picture" in fancy: |
|
|
|
bg_path = os.path.join(disk_root, ".background", os.path.basename(fancy["background_picture"])) |
|
|
|
bg_path = os.path.join(disk_root, ".background", os.path.basename(fancy["background_picture"])) |
|
|
|
os.mkdir(os.path.dirname(bg_path)) |
|
|
|
os.mkdir(os.path.dirname(bg_path)) |
|
|
|
if verbose >= 3: |
|
|
|
if verbose >= 3: |
|
|
|
print fancy["background_picture"], "->", bg_path |
|
|
|
print(fancy["background_picture"], "->", bg_path) |
|
|
|
shutil.copy2(fancy["background_picture"], bg_path) |
|
|
|
shutil.copy2(fancy["background_picture"], bg_path) |
|
|
|
else: |
|
|
|
else: |
|
|
|
bg_path = None |
|
|
|
bg_path = None |
|
|
@ -839,8 +839,8 @@ if config.dmg is not None: |
|
|
|
|
|
|
|
|
|
|
|
itemscript = Template('set position of item "${item}" of container window to {${position}}') |
|
|
|
itemscript = Template('set position of item "${item}" of container window to {${position}}') |
|
|
|
items_positions = [] |
|
|
|
items_positions = [] |
|
|
|
if fancy.has_key("items_position"): |
|
|
|
if "items_position" in fancy: |
|
|
|
for name, position in fancy["items_position"].iteritems(): |
|
|
|
for name, position in fancy["items_position"].items(): |
|
|
|
params = { "item" : name, "position" : ",".join([str(p) for p in position]) } |
|
|
|
params = { "item" : name, "position" : ",".join([str(p) for p in position]) } |
|
|
|
items_positions.append(itemscript.substitute(params)) |
|
|
|
items_positions.append(itemscript.substitute(params)) |
|
|
|
|
|
|
|
|
|
|
@ -851,9 +851,9 @@ if config.dmg is not None: |
|
|
|
"background_commands" : "", |
|
|
|
"background_commands" : "", |
|
|
|
"items_positions" : "\n ".join(items_positions) |
|
|
|
"items_positions" : "\n ".join(items_positions) |
|
|
|
} |
|
|
|
} |
|
|
|
if fancy.has_key("window_bounds"): |
|
|
|
if "window_bounds" in fancy: |
|
|
|
params["window.bounds"] = ",".join([str(p) for p in fancy["window_bounds"]]) |
|
|
|
params["window.bounds"] = ",".join([str(p) for p in fancy["window_bounds"]]) |
|
|
|
if fancy.has_key("icon_size"): |
|
|
|
if "icon_size" in fancy: |
|
|
|
params["icon_size"] = str(fancy["icon_size"]) |
|
|
|
params["icon_size"] = str(fancy["icon_size"]) |
|
|
|
if bg_path is not None: |
|
|
|
if bg_path is not None: |
|
|
|
# Set background file, then call SetFile to make it invisible. |
|
|
|
# Set background file, then call SetFile to make it invisible. |
|
|
@ -873,7 +873,7 @@ if config.dmg is not None: |
|
|
|
print("Error running osascript.") |
|
|
|
print("Error running osascript.") |
|
|
|
|
|
|
|
|
|
|
|
if verbose >= 2: |
|
|
|
if verbose >= 2: |
|
|
|
print "+ Finalizing .dmg disk image +" |
|
|
|
print("+ Finalizing .dmg disk image +") |
|
|
|
time.sleep(5) |
|
|
|
time.sleep(5) |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
@ -886,6 +886,6 @@ if config.dmg is not None: |
|
|
|
# ------------------------------------------------ |
|
|
|
# ------------------------------------------------ |
|
|
|
|
|
|
|
|
|
|
|
if verbose >= 2: |
|
|
|
if verbose >= 2: |
|
|
|
print "+ Done +" |
|
|
|
print("+ Done +") |
|
|
|
|
|
|
|
|
|
|
|
sys.exit(0) |
|
|
|
sys.exit(0) |
|
|
|