aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2019-07-16 10:42:33 +0800
committerfanquake <fanquake@gmail.com>2019-07-29 08:28:41 +0800
commit51729a4dfacb5b8d3945d39fa581eaaa9ac9603d (patch)
treedc5250d41142005a46fb4605ec5b8a391c51e8cc
parent1c37e81694efb08fea889d9f5151c91dbb74d025 (diff)
scripts: use format() in macdeployqtplus
-rwxr-xr-xcontrib/macdeploy/macdeployqtplus64
1 files changed, 32 insertions, 32 deletions
diff --git a/contrib/macdeploy/macdeployqtplus b/contrib/macdeploy/macdeployqtplus
index c2d6b30293..bf1488b110 100755
--- a/contrib/macdeploy/macdeployqtplus
+++ b/contrib/macdeploy/macdeployqtplus
@@ -49,18 +49,18 @@ class FrameworkInfo(object):
return False
def __str__(self):
- return """ Framework name: %s
- Framework directory: %s
- Framework path: %s
- Binary name: %s
- Binary directory: %s
- Binary path: %s
- Version: %s
- Install name: %s
- Deployed install name: %s
- Source file Path: %s
- Deployed Directory (relative to bundle): %s
-""" % (self.frameworkName,
+ return """ Framework name: {}
+ Framework directory: {}
+ Framework path: {}
+ Binary name: {}
+ Binary directory: {}
+ Binary path: {}
+ Version: {}
+ Install name: {}
+ Deployed install name: {}
+ Source file Path: {}
+ Deployed Directory (relative to bundle): {}
+""".format(self.frameworkName,
self.frameworkDirectory,
self.frameworkPath,
self.binaryName,
@@ -182,8 +182,8 @@ class DeploymentInfo(object):
self.pluginPath = pluginPath
def usesFramework(self, name: str) -> bool:
- nameDot = "%s." % name
- libNameDot = "lib%s." % name
+ nameDot = "{}.".format(name)
+ libNameDot = "lib{}.".format(name)
for framework in self.deployedFrameworks:
if framework.endswith(".framework"):
if framework.startswith(nameDot):
@@ -203,7 +203,7 @@ def getFrameworks(binaryPath: str, verbose: int) -> List[FrameworkInfo]:
if verbose >= 1:
sys.stderr.write(o_stderr)
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.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:
frameworks = getFrameworks(applicationBundle.binaryPath, verbose)
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()
else:
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 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)
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]
else:
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)
# ------------------------------------------------
@@ -521,7 +521,7 @@ for p in config.add_resources:
print("Checking for \"%s\"..." % p)
if not os.path.exists(p):
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)
# ------------------------------------------------
@@ -538,17 +538,17 @@ if len(config.fancy) == 1:
p = config.fancy[0]
if verbose >= 3:
- print("Fancy: Loading \"%s\"..." % p)
+ print("Fancy: Loading \"{}\"...".format(p))
if not os.path.exists(p):
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)
try:
fancy = plistlib.readPlist(p)
except:
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)
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)
except:
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)
if "background_picture" in fancy:
bp = fancy["background_picture"]
if verbose >= 3:
- print("Fancy: Resolving background picture \"%s\"..." % bp)
+ print("Fancy: Resolving background picture \"{}\"...".format(bp))
if not os.path.exists(bp):
bp = os.path.join(os.path.dirname(p), bp)
if not os.path.exists(bp):
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)
else:
fancy["background_picture"] = bp
@@ -624,7 +624,7 @@ try:
config.plugins = False
except RuntimeError as e:
if verbose >= 1:
- sys.stderr.write("Error: %s\n" % str(e))
+ sys.stderr.write("Error: {}\n".format(str(e)))
sys.exit(1)
# ------------------------------------------------
@@ -637,7 +637,7 @@ if config.plugins:
deployPlugins(applicationBundle, deploymentInfo, config.strip, verbose)
except RuntimeError as e:
if verbose >= 1:
- sys.stderr.write("Error: %s\n" % str(e))
+ sys.stderr.write("Error: {}\n".format(str(e)))
sys.exit(1)
# ------------------------------------------------
@@ -653,14 +653,14 @@ else:
else:
sys.stderr.write("Error: Could not find Qt translation path\n")
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:
p = os.path.join(qt_tr_dir, lng_file)
if verbose >= 3:
- print("Checking for \"%s\"..." % p)
+ print("Checking for \"{}\"...".format(p))
if not os.path.exists(p):
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)
# ------------------------------------------------
@@ -701,8 +701,8 @@ if config.sign and 'CODESIGNARGS' not in os.environ:
print("You must set the CODESIGNARGS environment variable. Skipping signing.")
elif config.sign:
if verbose >= 1:
- print("Code-signing app bundle %s"%(target,))
- subprocess.check_call("codesign --force %s %s"%(os.environ['CODESIGNARGS'], target), shell=True)
+ print("Code-signing app bundle {}".format(target))
+ subprocess.check_call("codesign --force {} {}".format(os.environ['CODESIGNARGS'], target), shell=True)
# ------------------------------------------------