scripts: use format() in macdeployqtplus
This commit is contained in:
parent
1c37e81694
commit
51729a4dfa
1 changed files with 32 additions and 32 deletions
|
@ -49,18 +49,18 @@ class FrameworkInfo(object):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return """ Framework name: %s
|
return """ Framework name: {}
|
||||||
Framework directory: %s
|
Framework directory: {}
|
||||||
Framework path: %s
|
Framework path: {}
|
||||||
Binary name: %s
|
Binary name: {}
|
||||||
Binary directory: %s
|
Binary directory: {}
|
||||||
Binary path: %s
|
Binary path: {}
|
||||||
Version: %s
|
Version: {}
|
||||||
Install name: %s
|
Install name: {}
|
||||||
Deployed install name: %s
|
Deployed install name: {}
|
||||||
Source file Path: %s
|
Source file Path: {}
|
||||||
Deployed Directory (relative to bundle): %s
|
Deployed Directory (relative to bundle): {}
|
||||||
""" % (self.frameworkName,
|
""".format(self.frameworkName,
|
||||||
self.frameworkDirectory,
|
self.frameworkDirectory,
|
||||||
self.frameworkPath,
|
self.frameworkPath,
|
||||||
self.binaryName,
|
self.binaryName,
|
||||||
|
@ -182,8 +182,8 @@ class DeploymentInfo(object):
|
||||||
self.pluginPath = pluginPath
|
self.pluginPath = pluginPath
|
||||||
|
|
||||||
def usesFramework(self, name: str) -> bool:
|
def usesFramework(self, name: str) -> bool:
|
||||||
nameDot = "%s." % name
|
nameDot = "{}.".format(name)
|
||||||
libNameDot = "lib%s." % name
|
libNameDot = "lib{}.".format(name)
|
||||||
for framework in self.deployedFrameworks:
|
for framework in self.deployedFrameworks:
|
||||||
if framework.endswith(".framework"):
|
if framework.endswith(".framework"):
|
||||||
if framework.startswith(nameDot):
|
if framework.startswith(nameDot):
|
||||||
|
@ -203,7 +203,7 @@ def getFrameworks(binaryPath: str, verbose: int) -> List[FrameworkInfo]:
|
||||||
if verbose >= 1:
|
if verbose >= 1:
|
||||||
sys.stderr.write(o_stderr)
|
sys.stderr.write(o_stderr)
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
raise RuntimeError("otool failed with return code %d" % otool.returncode)
|
raise RuntimeError("otool failed with return code {}".format(otool.returncode))
|
||||||
|
|
||||||
otoolLines = o_stdout.split("\n")
|
otoolLines = o_stdout.split("\n")
|
||||||
otoolLines.pop(0) # First line is the inspected binary
|
otoolLines.pop(0) # First line is the inspected binary
|
||||||
|
@ -359,7 +359,7 @@ def deployFrameworks(frameworks: List[FrameworkInfo], bundlePath: str, binaryPat
|
||||||
def deployFrameworksForAppBundle(applicationBundle: ApplicationBundleInfo, strip: bool, verbose: int) -> DeploymentInfo:
|
def deployFrameworksForAppBundle(applicationBundle: ApplicationBundleInfo, strip: bool, verbose: int) -> DeploymentInfo:
|
||||||
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 {}.".format(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)
|
||||||
|
@ -500,7 +500,7 @@ app_bundle = config.app_bundle[0]
|
||||||
|
|
||||||
if not os.path.exists(app_bundle):
|
if not os.path.exists(app_bundle):
|
||||||
if verbose >= 1:
|
if verbose >= 1:
|
||||||
sys.stderr.write("Error: Could not find app bundle \"%s\"\n" % (app_bundle))
|
sys.stderr.write("Error: Could not find app bundle \"{}\"\n".format(app_bundle))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
app_bundle_name = os.path.splitext(os.path.basename(app_bundle))[0]
|
app_bundle_name = os.path.splitext(os.path.basename(app_bundle))[0]
|
||||||
|
@ -512,7 +512,7 @@ if config.translations_dir and config.translations_dir[0]:
|
||||||
translations_dir = config.translations_dir[0]
|
translations_dir = config.translations_dir[0]
|
||||||
else:
|
else:
|
||||||
if verbose >= 1:
|
if verbose >= 1:
|
||||||
sys.stderr.write("Error: Could not find translation dir \"%s\"\n" % (translations_dir))
|
sys.stderr.write("Error: Could not find translation dir \"{}\"\n".format(translations_dir))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
# ------------------------------------------------
|
# ------------------------------------------------
|
||||||
|
|
||||||
|
@ -521,7 +521,7 @@ for p in config.add_resources:
|
||||||
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 \"{}\"\n".format(p))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# ------------------------------------------------
|
# ------------------------------------------------
|
||||||
|
@ -538,17 +538,17 @@ 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 \"{}\"...".format(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 \"{}\"\n".format(p))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fancy = plistlib.readPlist(p)
|
fancy = plistlib.readPlist(p)
|
||||||
except:
|
except:
|
||||||
if verbose >= 1:
|
if verbose >= 1:
|
||||||
sys.stderr.write("Error: Could not parse fancy disk image plist at \"%s\"\n" % (p))
|
sys.stderr.write("Error: Could not parse fancy disk image plist at \"{}\"\n".format(p))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -562,18 +562,18 @@ if len(config.fancy) == 1:
|
||||||
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 \"{}\"\n".format(p))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if "background_picture" in fancy:
|
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 \"{}\"...".format(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):
|
||||||
if verbose >= 1:
|
if verbose >= 1:
|
||||||
sys.stderr.write("Error: Could not find background picture at \"%s\" or \"%s\"\n" % (fancy["background_picture"], bp))
|
sys.stderr.write("Error: Could not find background picture at \"{}\" or \"{}\"\n".format(fancy["background_picture"], bp))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
fancy["background_picture"] = bp
|
fancy["background_picture"] = bp
|
||||||
|
@ -624,7 +624,7 @@ try:
|
||||||
config.plugins = False
|
config.plugins = False
|
||||||
except RuntimeError as e:
|
except RuntimeError as e:
|
||||||
if verbose >= 1:
|
if verbose >= 1:
|
||||||
sys.stderr.write("Error: %s\n" % str(e))
|
sys.stderr.write("Error: {}\n".format(str(e)))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# ------------------------------------------------
|
# ------------------------------------------------
|
||||||
|
@ -637,7 +637,7 @@ if config.plugins:
|
||||||
deployPlugins(applicationBundle, deploymentInfo, config.strip, verbose)
|
deployPlugins(applicationBundle, deploymentInfo, config.strip, verbose)
|
||||||
except RuntimeError as e:
|
except RuntimeError as e:
|
||||||
if verbose >= 1:
|
if verbose >= 1:
|
||||||
sys.stderr.write("Error: %s\n" % str(e))
|
sys.stderr.write("Error: {}\n".format(str(e)))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# ------------------------------------------------
|
# ------------------------------------------------
|
||||||
|
@ -653,14 +653,14 @@ else:
|
||||||
else:
|
else:
|
||||||
sys.stderr.write("Error: Could not find Qt translation path\n")
|
sys.stderr.write("Error: Could not find Qt translation path\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
add_qt_tr = ["qt_%s.qm" % lng for lng in config.add_qt_tr[0].split(",")]
|
add_qt_tr = ["qt_{}.qm".format(lng) for lng in config.add_qt_tr[0].split(",")]
|
||||||
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 \"{}\"...".format(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 \"{}\"\n".format(lng_file))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# ------------------------------------------------
|
# ------------------------------------------------
|
||||||
|
@ -701,8 +701,8 @@ 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 {}".format(target))
|
||||||
subprocess.check_call("codesign --force %s %s"%(os.environ['CODESIGNARGS'], target), shell=True)
|
subprocess.check_call("codesign --force {} {}".format(os.environ['CODESIGNARGS'], target), shell=True)
|
||||||
|
|
||||||
# ------------------------------------------------
|
# ------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue