chiark / gitweb /
fix string formats that are ambiguous for translators
authorHans-Christoph Steiner <hans@eds.org>
Fri, 15 Sep 2017 21:20:29 +0000 (23:20 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Sat, 16 Sep 2017 11:19:38 +0000 (13:19 +0200)
fdroidserver/checkupdates.py
fdroidserver/common.py
fdroidserver/install.py
fdroidserver/lint.py
fdroidserver/publish.py
fdroidserver/rewritemeta.py
fdroidserver/scanner.py
fdroidserver/signatures.py
fdroidserver/update.py
fdroidserver/verify.py

index 7c269c1f366f849531e4c3b4bbd94555ec6ac19b..02baa061d54f085471a188a5a17bda95cc8585df 100644 (file)
@@ -558,15 +558,16 @@ def main():
     for appid, app in apps.items():
 
         if options.autoonly and app.AutoUpdateMode in ('None', 'Static'):
-            logging.debug("Nothing to do for {0}...".format(appid))
+            logging.debug(_("Nothing to do for {appid}.").format(appid=appid))
             continue
 
-        logging.info("Processing " + appid + '...')
+        logging.info(_("Processing {appid}").format(appid=appid))
 
         try:
             checkupdates_app(app)
         except Exception as e:
-            logging.error("...checkupdate failed for {0} : {1}".format(appid, e))
+            logging.error(_("...checkupdate failed for {appid} : {error}")
+                          .format(appid=appid, error=e))
 
     logging.info(_("Finished"))
 
index 9b82cf302c800b3e190bcfebec7049c22f984b5a..98aab2093bd79808d978f437a61b1b0540ff7ba6 100644 (file)
@@ -235,18 +235,19 @@ def read_config(opts, config_file='config.py'):
     config = {}
 
     if os.path.isfile(config_file):
-        logging.debug("Reading %s" % config_file)
+        logging.debug(_("Reading '{config_file}'").format(config_file=config_file))
         with io.open(config_file, "rb") as f:
             code = compile(f.read(), config_file, 'exec')
             exec(code, None, config)
     else:
-        logging.warning("No config.py found - using defaults.")
+        logging.warning(_("No 'config.py' found, using defaults."))
 
     for k in ('mirrors', 'install_list', 'uninstall_list', 'serverwebroot', 'servergitroot'):
         if k in config:
             if not type(config[k]) in (str, list, tuple):
-                logging.warn('"' + k + '" will be in random order!'
-                             + ' Use () or [] brackets if order is important!')
+                logging.warning(
+                    _("'{field}' will be in random order! Use () or [] brackets if order is important!")
+                    .format(field=k))
 
     # smartcardoptions must be a list since its command line args for Popen
     if 'smartcardoptions' in config:
@@ -261,7 +262,8 @@ def read_config(opts, config_file='config.py'):
     if any(k in config for k in ["keystore", "keystorepass", "keypass"]):
         st = os.stat(config_file)
         if st.st_mode & stat.S_IRWXG or st.st_mode & stat.S_IRWXO:
-            logging.warning("unsafe permissions on {0} (should be 0600)!".format(config_file))
+            logging.warning(_("unsafe permissions on '{config_file}' (should be 0600)!")
+                            .format(config_file=config_file))
 
     fill_config_defaults(config)
 
@@ -275,7 +277,7 @@ def read_config(opts, config_file='config.py'):
         elif all(isinstance(item, str) for item in config['serverwebroot']):
             roots = config['serverwebroot']
         else:
-            raise TypeError('only accepts strings, lists, and tuples')
+            raise TypeError(_('only accepts strings, lists, and tuples'))
         rootlist = []
         for rootstr in roots:
             # since this is used with rsync, where trailing slashes have
@@ -291,7 +293,7 @@ def read_config(opts, config_file='config.py'):
         elif all(isinstance(item, str) for item in config['servergitmirrors']):
             roots = config['servergitmirrors']
         else:
-            raise TypeError('only accepts strings, lists, and tuples')
+            raise TypeError(_('only accepts strings, lists, and tuples'))
         config['servergitmirrors'] = roots
 
     return config
@@ -336,7 +338,7 @@ def test_aapt_version(aapt):
     '''Check whether the version of aapt is new enough'''
     output = subprocess.check_output([aapt, 'version'], universal_newlines=True)
     if output is None or output == '':
-        logging.error(aapt + ' failed to execute!')
+        logging.error(_("'{path}' failed to execute!").format(path=aapt))
     else:
         m = re.match(r'.*v([0-9]+)\.([0-9]+)[.-]?([0-9.-]*)', output)
         if m:
@@ -345,9 +347,10 @@ def test_aapt_version(aapt):
             bugfix = m.group(3)
             # the Debian package has the version string like "v0.2-23.0.2"
             if '.' not in bugfix and LooseVersion('.'.join((major, minor, bugfix))) < LooseVersion('0.2.2166767'):
-                logging.warning(aapt + ' is too old, fdroid requires build-tools-23.0.0 or newer!')
+                logging.warning(_("'{aapt}' is too old, fdroid requires build-tools-23.0.0 or newer!")
+                                .format(aapt=aapt))
         else:
-            logging.warning('Unknown version of aapt, might cause problems: ' + output)
+            logging.warning(_('Unknown version of aapt, might cause problems: ') + output)
 
 
 def test_sdk_exists(thisconfig):
@@ -356,35 +359,38 @@ def test_sdk_exists(thisconfig):
             test_aapt_version(thisconfig['aapt'])
             return True
         else:
-            logging.error("'sdk_path' not set in config.py!")
+            logging.error(_("'sdk_path' not set in 'config.py'!"))
             return False
     if thisconfig['sdk_path'] == default_config['sdk_path']:
-        logging.error('No Android SDK found!')
-        logging.error('You can use ANDROID_HOME to set the path to your SDK, i.e.:')
+        logging.error(_('No Android SDK found!'))
+        logging.error(_('You can use ANDROID_HOME to set the path to your SDK, i.e.:'))
         logging.error('\texport ANDROID_HOME=/opt/android-sdk')
         return False
     if not os.path.exists(thisconfig['sdk_path']):
-        logging.critical('Android SDK path "' + thisconfig['sdk_path'] + '" does not exist!')
+        logging.critical(_("Android SDK path '{path}' does not exist!")
+                         .format(path=thisconfig['sdk_path']))
         return False
     if not os.path.isdir(thisconfig['sdk_path']):
-        logging.critical('Android SDK path "' + thisconfig['sdk_path'] + '" is not a directory!')
+        logging.critical(_("Android SDK path '{path}' is not a directory!")
+                         .format(path=thisconfig['sdk_path']))
         return False
     for d in ['build-tools', 'platform-tools', 'tools']:
         if not os.path.isdir(os.path.join(thisconfig['sdk_path'], d)):
-            logging.critical('Android SDK path "%s" does not contain "%s/"!' % (
-                thisconfig['sdk_path'], d))
+            logging.critical(_("Android SDK '{path}' does not have '{dirname}' installed!")
+                             .format(path=thisconfig['sdk_path'], dirname=d))
             return False
     return True
 
 
 def ensure_build_tools_exists(thisconfig):
     if not test_sdk_exists(thisconfig):
-        raise FDroidException("Android SDK not found.")
+        raise FDroidException(_("Android SDK not found!"))
     build_tools = os.path.join(thisconfig['sdk_path'], 'build-tools')
     versioned_build_tools = os.path.join(build_tools, thisconfig['build_tools'])
     if not os.path.isdir(versioned_build_tools):
         raise FDroidException(
-            'Android Build Tools path "' + versioned_build_tools + '" does not exist!')
+            _("Android Build Tools path '{path}' does not exist!")
+            .format(path=versioned_build_tools))
 
 
 def get_local_metadata_files():
@@ -440,10 +446,10 @@ def read_app_args(args, allapps, allow_vercodes=False):
     if len(apps) != len(vercodes):
         for p in vercodes:
             if p not in allapps:
-                logging.critical("No such package: %s" % p)
-        raise FDroidException("Found invalid app ids in arguments")
+                logging.critical(_("No such package: %s") % p)
+        raise FDroidException(_("Found invalid appids in arguments"))
     if not apps:
-        raise FDroidException("No packages specified")
+        raise FDroidException(_("No packages specified"))
 
     error = False
     for appid, app in apps.items():
@@ -456,10 +462,11 @@ def read_app_args(args, allapps, allow_vercodes=False):
             allvcs = [b.versionCode for b in app.builds]
             for v in vercodes[appid]:
                 if v not in allvcs:
-                    logging.critical("No such vercode %s for app %s" % (v, appid))
+                    logging.critical(_("No such versionCode {versionCode} for app {appid}")
+                                     .format(versionCode=v, appid=appid))
 
     if error:
-        raise FDroidException("Found invalid vercodes for some apps")
+        raise FDroidException(_("Found invalid versionCodes for some apps"))
 
     return apps
 
@@ -498,7 +505,7 @@ def publishednameinfo(filename):
     try:
         result = (m.group(1), m.group(2))
     except AttributeError:
-        raise FDroidException("Invalid name for published file: %s" % filename)
+        raise FDroidException(_("Invalid name for published file: %s") % filename)
     return result
 
 
@@ -590,7 +597,7 @@ class vcs:
                     raise VCSException("Authentication is not supported for git-svn")
                 self.username, remote = remote.split('@')
                 if ':' not in self.username:
-                    raise VCSException("Password required with username")
+                    raise VCSException(_("Password required with username"))
                 self.username, self.password = self.username.split(':')
 
         self.remote = remote
@@ -612,7 +619,7 @@ class vcs:
     def gotorevision(self, rev, refresh=True):
 
         if self.clone_failed:
-            raise VCSException("Downloading the repository already failed once, not trying again.")
+            raise VCSException(_("Downloading the repository already failed once, not trying again."))
 
         # The .fdroidvcs-id file for a repo tells us what VCS type
         # and remote that directory was created from, allowing us to drop it
@@ -720,48 +727,48 @@ class vcs_git(vcs):
             p = FDroidPopen(['git', 'submodule', 'foreach', '--recursive',
                              'git', 'reset', '--hard'], cwd=self.local, output=False)
             if p.returncode != 0:
-                raise VCSException("Git reset failed", p.output)
+                raise VCSException(_("Git reset failed"), p.output)
             # Remove untracked files now, in case they're tracked in the target
             # revision (it happens!)
             p = FDroidPopen(['git', 'submodule', 'foreach', '--recursive',
                              'git', 'clean', '-dffx'], cwd=self.local, output=False)
             if p.returncode != 0:
-                raise VCSException("Git clean failed", p.output)
+                raise VCSException(_("Git clean failed"), p.output)
             if not self.refreshed:
                 # Get latest commits and tags from remote
                 p = FDroidPopen(['git', 'fetch', 'origin'], cwd=self.local)
                 if p.returncode != 0:
-                    raise VCSException("Git fetch failed", p.output)
+                    raise VCSException(_("Git fetch failed"), p.output)
                 p = FDroidPopen(['git', 'fetch', '--prune', '--tags', 'origin'], cwd=self.local, output=False)
                 if p.returncode != 0:
-                    raise VCSException("Git fetch failed", p.output)
+                    raise VCSException(_("Git fetch failed"), p.output)
                 # Recreate origin/HEAD as git clone would do it, in case it disappeared
                 p = FDroidPopen(['git', 'remote', 'set-head', 'origin', '--auto'], cwd=self.local, output=False)
                 if p.returncode != 0:
                     lines = p.output.splitlines()
                     if 'Multiple remote HEAD branches' not in lines[0]:
-                        raise VCSException("Git remote set-head failed", p.output)
+                        raise VCSException(_("Git remote set-head failed"), p.output)
                     branch = lines[1].split(' ')[-1]
                     p2 = FDroidPopen(['git', 'remote', 'set-head', 'origin', branch], cwd=self.local, output=False)
                     if p2.returncode != 0:
-                        raise VCSException("Git remote set-head failed", p.output + '\n' + p2.output)
+                        raise VCSException(_("Git remote set-head failed"), p.output + '\n' + p2.output)
                 self.refreshed = True
         # origin/HEAD is the HEAD of the remote, e.g. the "default branch" on
         # a github repo. Most of the time this is the same as origin/master.
         rev = rev or 'origin/HEAD'
         p = FDroidPopen(['git', 'checkout', '-f', rev], cwd=self.local, output=False)
         if p.returncode != 0:
-            raise VCSException("Git checkout of '%s' failed" % rev, p.output)
+            raise VCSException(_("Git checkout of '%s' failed") % rev, p.output)
         # Get rid of any uncontrolled files left behind
         p = FDroidPopen(['git', 'clean', '-dffx'], cwd=self.local, output=False)
         if p.returncode != 0:
-            raise VCSException("Git clean failed", p.output)
+            raise VCSException(_("Git clean failed"), p.output)
 
     def initsubmodules(self):
         self.checkrepo()
         submfile = os.path.join(self.local, '.gitmodules')
         if not os.path.isfile(submfile):
-            raise VCSException("No git submodules available")
+            raise VCSException(_("No git submodules available"))
 
         # fix submodules not accessible without an account and public key auth
         with open(submfile, 'r') as f:
@@ -776,10 +783,10 @@ class vcs_git(vcs):
 
         p = FDroidPopen(['git', 'submodule', 'sync'], cwd=self.local, output=False)
         if p.returncode != 0:
-            raise VCSException("Git submodule sync failed", p.output)
+            raise VCSException(_("Git submodule sync failed"), p.output)
         p = FDroidPopen(['git', 'submodule', 'update', '--init', '--force', '--recursive'], cwd=self.local)
         if p.returncode != 0:
-            raise VCSException("Git submodule update failed", p.output)
+            raise VCSException(_("Git submodule update failed"), p.output)
 
     def _gettags(self):
         self.checkrepo()
@@ -902,12 +909,12 @@ class vcs_gitsvn(vcs):
                     # Check out the git rev equivalent to the svn rev
                     p = FDroidPopen(['git', 'checkout', git_rev], cwd=self.local, output=False)
                     if p.returncode != 0:
-                        raise VCSException("Git checkout of '%s' failed" % rev, p.output)
+                        raise VCSException(_("Git checkout of '%s' failed") % rev, p.output)
 
         # Get rid of any uncontrolled files left behind
         p = FDroidPopen(['git', 'clean', '-dffx'], cwd=self.local, output=False)
         if p.returncode != 0:
-            raise VCSException("Git clean failed", p.output)
+            raise VCSException(_("Git clean failed"), p.output)
 
     def _gettags(self):
         self.checkrepo()
@@ -1164,7 +1171,7 @@ def parse_androidmanifests(paths, app):
         if not os.path.isfile(path):
             continue
 
-        logging.debug("Parsing manifest at {0}".format(path))
+        logging.debug(_("Parsing manifest at '{path}'").format(path=path))
         version = None
         vercode = None
         package = None
@@ -1206,7 +1213,7 @@ def parse_androidmanifests(paths, app):
                     if string_is_integer(a):
                         vercode = a
             except Exception:
-                logging.warning("Problem with xml at {0}".format(path))
+                logging.warning(_("Problem with xml at '{path}'").format(path=path))
 
         # Remember package name, may be defined separately from version+vercode
         if package is None:
@@ -1238,7 +1245,7 @@ def parse_androidmanifests(paths, app):
         max_version = "Unknown"
 
     if max_package and not is_valid_package_name(max_package):
-        raise FDroidException("Invalid package name {0}".format(max_package))
+        raise FDroidException(_("Invalid package name {0}").format(max_package))
 
     return (max_version, max_vercode, max_package)
 
@@ -1346,7 +1353,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
 
     # Initialise submodules if required
     if build.submodules:
-        logging.info("Initialising submodules")
+        logging.info(_("Initialising submodules"))
         vcs.initsubmodules()
 
     # Check that a subdir (if we're using one) exists. This has to happen
@@ -1476,7 +1483,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
 
     # Delete unwanted files
     if build.rm:
-        logging.info("Removing specified files")
+        logging.info(_("Removing specified files"))
         for part in getpaths(build_dir, build.rm):
             dest = os.path.join(build_dir, part)
             logging.info("Removing {0}".format(part))
@@ -1672,7 +1679,7 @@ def get_apk_debuggable_aapt(apkfile):
     p = SdkToolsPopen(['aapt', 'dump', 'xmltree', apkfile, 'AndroidManifest.xml'],
                       output=False)
     if p.returncode != 0:
-        raise FDroidException("Failed to get apk manifest information")
+        raise FDroidException(_("Failed to get APK manifest information"))
     for line in p.output.splitlines():
         if 'android:debuggable' in line and not line.endswith('0x0'):
             return True
@@ -1719,7 +1726,8 @@ def get_apk_id_aapt(apkfile):
         m = r.match(line)
         if m:
             return m.group('appid'), m.group('vercode'), m.group('vername')
-    raise FDroidException("reading identification failed, APK invalid: '{}'".format(apkfile))
+    raise FDroidException(_("Reading packageName/versionCode/versionName failed, APK invalid: '{apkfilename}'")
+                          .format(apkfilename=apkfile))
 
 
 class PopenResult:
@@ -1734,7 +1742,7 @@ def SdkToolsPopen(commands, cwd=None, output=True):
         config[cmd] = find_sdk_tools_cmd(commands[0])
     abscmd = config[cmd]
     if abscmd is None:
-        raise FDroidException("Could not find '%s' on your system" % cmd)
+        raise FDroidException(_("Could not find '{command}' on your system").format(command=cmd))
     if cmd == 'aapt':
         test_aapt_version(config['aapt'])
     return FDroidPopen([abscmd] + commands[1:],
index e3e21ff5a4dfe5a0f5da01ce16d9c820aa70b058..968bb28fcfd97b4e31e2aa2ec1e30b2e14c1d9d7 100644 (file)
@@ -99,7 +99,7 @@ def main():
             raise FDroidException(_("No attached devices found"))
         logging.info(_("Installing %s...") % apk)
         for dev in devs:
-            logging.info(_("Installing %s on %s...") % (apk, dev))
+            logging.info(_("Installing '{apkfilename}' on {dev}...").format(apkfilename=apk, dev=dev))
             p = SdkToolsPopen(['adb', "-s", dev, "install", apk])
             fail = ""
             for line in p.output.splitlines():
@@ -109,10 +109,11 @@ def main():
                 continue
 
             if fail == "INSTALL_FAILED_ALREADY_EXISTS":
-                logging.warn(_("%s is already installed on %s.") % (apk, dev))
+                logging.warn(_("'{apkfilename}' is already installed on {dev}.")
+                             .format(apkfilename=apk, dev=dev))
             else:
-                raise FDroidException(_("Failed to install %s on %s: %s") % (
-                    apk, dev, fail))
+                raise FDroidException(_("Failed to install '{apkfilename}' on {dev}: {error}")
+                                      .format(apkfilename=apk, dev=dev, error=fail))
 
     logging.info('\n' + _('Finished'))
 
index 492a09fc05a87b607077a10f1e063bc39516f438..beaf097afd029dc21df2c12b96c678201a19d89d 100644 (file)
@@ -156,20 +156,20 @@ def check_ucm_tags(app):
             and lastbuild.versionCode == app.CurrentVersionCode
             and not lastbuild.forcevercode
             and any(s in lastbuild.commit for s in '.,_-/')):
-        yield _("Last used commit '%s' looks like a tag, but Update Check Mode is '%s'") % (
-            lastbuild.commit, app.UpdateCheckMode)
+        yield _("Last used commit '{commit}' looks like a tag, but Update Check Mode is '{ucm}'")\
+            .format(commit=lastbuild.commit, ucm=app.UpdateCheckMode)
 
 
 def check_char_limits(app):
     limits = config['char_limits']
 
     if len(app.Summary) > limits['summary']:
-        yield _("Summary of length %s is over the %i char limit") % (
-            len(app.Summary), limits['summary'])
+        yield _("Summary of length {length} is over the {limit} char limit")\
+            .format(length=len(app.Summary), limit=limits['summary'])
 
     if len(app.Description) > limits['description']:
-        yield _("Description of length %s is over the %i char limit") % (
-            len(app.Description), limits['description'])
+        yield _("Description of length {length} is over the {limit} char limit")\
+            .format(length=len(app.Description), limit=limits['description'])
 
 
 def check_old_links(app):
@@ -186,7 +186,8 @@ def check_old_links(app):
         for f in ['WebSite', 'SourceCode', 'IssueTracker', 'Changelog']:
             v = app.get(f)
             if any(s in v for s in old_sites):
-                yield _("App is in '%s' but has a link to '%s'") % (app.Repo, v)
+                yield _("App is in '{repo}' but has a link to {url}")\
+                    .format(repo=app.Repo, url=v)
 
 
 def check_useless_fields(app):
@@ -246,7 +247,7 @@ def check_duplicates(app):
             continue
         v = v.lower()
         if v in links_seen:
-            yield _("Duplicate link in '%s': %s") % (f, v)
+            yield _("Duplicate link in '{field}': {url}").format(field=f, url=v)
         else:
             links_seen.add(v)
 
@@ -277,7 +278,7 @@ def check_mediawiki_links(app):
         url = um.group(1)
         for m, r in http_checks:
             if m.match(url):
-                yield _("URL '%s' in Description: %s") % (url, r)
+                yield _("URL {url} in Description: {error}").format(url=url, error=r)
 
 
 def check_bulleted_lists(app):
@@ -309,11 +310,13 @@ def check_builds(app):
             continue
         for s in ['master', 'origin', 'HEAD', 'default', 'trunk']:
             if build.commit and build.commit.startswith(s):
-                yield _("Branch '%s' used as commit in build '%s'") % (s, build.versionName)
+                yield _("Branch '{branch}' used as commit in build '{versionName}'")\
+                    .format(branch=s, versionName=build.versionName)
             for srclib in build.srclibs:
                 ref = srclib.split('@')[1].split('/')[0]
                 if ref.startswith(s):
-                    yield _("Branch '%s' used as commit in srclib '%s'") % (s, srclib)
+                    yield _("Branch '{branch}' used as commit in srclib '{srclib}'")\
+                        .format(branch=s, srclib=srclib)
         for key in build.keys():
             if key not in supported_flags:
                 yield _('%s is not an accepted build field') % key
@@ -335,7 +338,8 @@ def check_files_dir(app):
     for build in app.builds:
         for fname in build.patch:
             if fname not in files:
-                yield _("Unknown file %s in build '%s'") % (fname, build.versionName)
+                yield _("Unknown file '{filename}' in build '{versionName}'")\
+                    .format(filename=fname, versionName=build.versionName)
             else:
                 used.add(fname)
 
@@ -369,7 +373,8 @@ def check_extlib_dir(apps):
         for build in app.builds:
             for path in build.extlibs:
                 if path not in unused_extlib_files:
-                    yield _("%s: Unknown extlib %s in build '%s'") % (app.id, path, build.versionName)
+                    yield _("{appid}: Unknown extlib {path} in build '{versionName}'")\
+                        .format(appid=app.id, path=path, versionName=build.versionName)
                 else:
                     used.add(path)
 
index b15c12a8553e93e031a9bdc12ac84dcd269dc8fd..bafa29f693f20ca297b2bc3b2259d32130701755 100644 (file)
@@ -114,7 +114,7 @@ def main():
         if appid in vercodes and vercodes[appid]:
             if vercode not in vercodes[appid]:
                 continue
-        logging.info("Processing " + apkfile)
+        logging.info(_("Processing {apkfilename}").format(apkfilename=apkfile))
 
         # There ought to be valid metadata for this app, otherwise why are we
         # trying to publish it?
index 776e1f14c41e034b1db3f6e80b908d63d86668c5..ed941bd7b289102cea98b7abf81e033d5fca5818 100644 (file)
@@ -70,18 +70,19 @@ def main():
         parser.error(_("Cannot use --list and --to at the same time"))
 
     if options.to is not None and options.to not in supported:
-        parser.error(_("Unsupported metadata format, use: --to [%s]") % ' '.join(supported))
+        parser.error(_("Unsupported metadata format, use: --to [{supported}]")
+                     .format(supported=' '.join(supported)))
 
     for appid, app in apps.items():
         path = app.metadatapath
         base, ext = common.get_extension(path)
         if not options.to and ext not in supported:
-            logging.info(_("Ignoring %s file at '%s'") % (ext, path))
+            logging.info(_("Ignoring {ext} file at '{path}'").format(ext=ext, path=path))
             continue
         elif options.to is not None:
-            logging.info(_("rewriting '%s' to %s") % (appid, options.to))
+            logging.info(_("Rewriting '{appid}' to '{path}'").format(appid=appid, path=options.to))
         else:
-            logging.info(_("rewriting '%s'") % (appid))
+            logging.info(_("Rewriting '{appid}'").format(appid=appid))
 
         to_ext = ext
         if options.to is not None:
index 874f0b0081d72e489981ea74cc73a89f02a2c7fb..446091dc38b857e371d42d08be3ba7b2f8d66f53 100644 (file)
@@ -280,13 +280,13 @@ def main():
     for appid, app in apps.items():
 
         if app.Disabled:
-            logging.info("Skipping %s: disabled" % appid)
+            logging.info(_("Skipping {appid}: disabled").format(appid=appid))
             continue
         if not app.builds:
-            logging.info("Skipping %s: no builds specified" % appid)
+            logging.info(_("Skipping {appid}: no builds specified").format(appid=appid))
             continue
 
-        logging.info("Processing " + appid)
+        logging.info(_("Processing {appid}").format(appid=appid))
 
         try:
 
index b5e7a7730ac268ea997a1369efe846ac035adcb1..9433e49a517d1d50ce48e425cf35abda7ab05c48 100644 (file)
@@ -62,21 +62,24 @@ def extract(config, options):
         try:
             if os.path.isfile(apk):
                 sigdir = extract_signature(apk)
-                logging.info(_('fetched signatures for %s -> %s'), apk, sigdir)
+                logging.info(_("Fetched signatures for '{apkfilename}' -> '{sigdir}'")
+                             .format(apkfilename=apk, sigdir=sigdir))
             elif httpre.match(apk):
                 if apk.startswith('https') or options.no_check_https:
                     try:
                         tmp_apk = os.path.join(tmp_dir, 'signed.apk')
                         net.download_file(apk, tmp_apk)
                         sigdir = extract_signature(tmp_apk)
-                        logging.info(_('fetched signatures for %s -> %s'), apk, sigdir)
+                        logging.info(_("Fetched signatures for '{apkfilename}' -> '{sigdir}'")
+                                     .format(apkfilename=apk, sigdir=sigdir))
                     finally:
                         if tmp_apk and os.path.exists(tmp_apk):
                             os.remove(tmp_apk)
                 else:
-                    logging.warn(_('refuse downloading via insecure http connection (use https or specify --no-https-check): %s'), apk)
+                    logging.warn(_('refuse downloading via insecure http connection (use https or specify --no-https-check): {apkfilename}').format(apkfilename=apk))
         except FDroidException as e:
-            logging.warning(_("failed fetching signatures for '%s': %s"), apk, e)
+            logging.warning(_("Failed fetching signatures for '{apkfilename}': {error}")
+                            .format(apkfilename=apk, error=e))
             if e.detail:
                 logging.debug(e.detail)
 
index 8777fadb2b0f9f50e3a723d9f366a83c895cb9b5..653792764674a50ba80fc765805eb87856841659 100644 (file)
@@ -904,7 +904,7 @@ def scan_repo_files(apkcache, repodir, knownapks, use_date_from_file=False):
                 logging.debug("Ignoring stale cache data for " + name)
 
         if not usecache:
-            logging.debug("Processing " + name_utf8)
+            logging.debug(_("Processing {apkfilename}").format(apkfilename=name_utf8))
             repo_file = collections.OrderedDict()
             repo_file['name'] = os.path.splitext(name_utf8)[0]
             # TODO rename apkname globally to something more generic
@@ -1221,12 +1221,13 @@ def process_apk(apkcache, apkfilename, repodir, knownapks, use_date_from_apk=Fal
             logging.debug("Ignoring stale cache data for " + apkfilename)
 
     if not usecache:
-        logging.debug("Processing " + apkfilename)
+        logging.debug(_("Processing {apkfilename}").format(apkfilename=apkfilename))
 
         try:
             apk = scan_apk(apkfile)
         except BuildException:
-            logging.warning('Skipping "%s" with invalid signature!', apkfilename)
+            logging.warning(_("Skipping '{apkfilename}' with invalid signature!")
+                            .format(apkfilename=apkfilename))
             return True, None, False
 
         # Check for debuggable apks...
index 9c4015583532b9aedb09854b91115d3175010331..73b94725a8d9291baac90a37758750d0474b989a 100644 (file)
@@ -71,7 +71,7 @@ def main():
 
         try:
 
-            logging.info("Processing " + apkfilename)
+            logging.info("Processing {apkfilename}".format(apkfilename=apkfilename))
 
             remoteapk = os.path.join(tmp_dir, apkfilename)
             if os.path.exists(remoteapk):
@@ -84,7 +84,8 @@ def main():
                 try:
                     net.download_file(url.replace('/repo', '/archive'), dldir=tmp_dir)
                 except requests.exceptions.HTTPError as e:
-                    raise FDroidException(_('Downloading %s failed. %s'), (url, e))
+                    raise FDroidException(_('Downloading {url} failed. {error}')
+                                          .format(url=url, error=e))
 
             compare_result = common.verify_apks(
                 remoteapk,