From 14f654fabc26b80a27f902b7ef2ec046dcb28d48 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Mart=C3=AD?= Date: Wed, 31 Dec 2014 16:42:26 +0100 Subject: [PATCH] Apply some autopep8-python2 suggestions --- fdroid | 2 +- fdroidserver/build.py | 8 ++++---- fdroidserver/common.py | 21 ++++++++++++--------- fdroidserver/lint.py | 26 +++++++++++++------------- fdroidserver/metadata.py | 7 ++++--- fdroidserver/stats.py | 2 +- makebuildserver | 2 +- setup.py | 6 +++--- 8 files changed, 39 insertions(+), 35 deletions(-) diff --git a/fdroid b/fdroid index ac32d7c1..ab901a7b 100755 --- a/fdroid +++ b/fdroid @@ -40,7 +40,7 @@ commands = { "scanner": "Scan the source code of a package", "stats": "Update the stats of the repo", "server": "Interact with the repo HTTP server", - } +} def print_help(): diff --git a/fdroidserver/build.py b/fdroidserver/build.py index 01eb2f96..677e4c88 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -48,7 +48,7 @@ def get_builder_vm_id(): if os.path.isdir(vd): # Vagrant 1.2 (and maybe 1.1?) it's a directory tree... with open(os.path.join(vd, 'machines', 'default', - 'virtualbox', 'id')) as vf: + 'virtualbox', 'id')) as vf: id = vf.read() return id else: @@ -71,7 +71,7 @@ def got_valid_builder_vm(): return True # Vagrant 1.2 - the directory can exist, but the id can be missing... if not os.path.exists(os.path.join(vd, 'machines', 'default', - 'virtualbox', 'id')): + 'virtualbox', 'id')): return False return True @@ -302,7 +302,7 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, force): ftp.put(os.path.join(serverpath, 'common.py'), 'common.py') ftp.put(os.path.join(serverpath, 'metadata.py'), 'metadata.py') ftp.put(os.path.join(serverpath, '..', 'buildserver', - 'config.buildserver.py'), 'config.py') + 'config.buildserver.py'), 'config.py') ftp.chmod('config.py', 0o600) # Copy over the ID (head commit hash) of the fdroidserver in use... @@ -824,7 +824,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d shutil.copyfile(os.path.join(homedir, fn), os.path.join(metadir, fn)) subprocess.call(['jar', 'uf', os.path.abspath(src), - 'META-INF/' + fn], cwd=tmp_dir) + 'META-INF/' + fn], cwd=tmp_dir) # Copy the unsigned apk to our destination directory for further # processing (by publish.py)... diff --git a/fdroidserver/common.py b/fdroidserver/common.py index adb3cd61..b9e7b81c 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -391,6 +391,7 @@ def getsrclibvcs(name): class vcs: + def __init__(self, remote, local): # svn, git-svn and bzr may require auth @@ -439,9 +440,8 @@ class vcs: writeback = False else: deleterepo = True - logging.info( - "Repository details for %s changed - deleting" % ( - self.local)) + logging.info("Repository details for %s changed - deleting" % ( + self.local)) else: deleterepo = True logging.info("Repository details for %s missing - deleting" % ( @@ -592,8 +592,9 @@ class vcs_git(vcs): def latesttags(self, alltags, number): self.checkrepo() p = FDroidPopen(['echo "' + '\n'.join(alltags) + '" | ' - + 'xargs -I@ git log --format=format:"%at @%n" -1 @ | ' - + 'sort -n | awk \'{print $2}\''], + + + 'xargs -I@ git log --format=format:"%at @%n" -1 @ | ' + + 'sort -n | awk \'{print $2}\''], cwd=self.local, shell=True, output=False) return p.output.splitlines()[-number:] @@ -1005,6 +1006,7 @@ def parse_androidmanifests(paths, ignoreversions=None): class FDroidException(Exception): + def __init__(self, value, detail=None): self.value = value self.detail = detail @@ -1415,7 +1417,7 @@ def scan_source(build_dir, root_dir, thisbuild): re.compile(r'crashlytics', re.IGNORECASE), re.compile(r'ouya.*sdk', re.IGNORECASE), re.compile(r'libspen23', re.IGNORECASE), - ] + ] scanignore = getpaths(build_dir, thisbuild, 'scanignore') scandelete = getpaths(build_dir, thisbuild, 'scandelete') @@ -1492,7 +1494,7 @@ def scan_source(build_dir, root_dir, thisbuild): 'application/java-archive', 'application/octet-stream', 'binary', - ): + ): if has_extension(fp, 'apk'): removeproblem('APK file', fd, fp) @@ -1610,6 +1612,7 @@ def isApkDebuggable(apkfile, config): class AsynchronousFileReader(threading.Thread): + ''' Helper class to implement asynchronous reading of a file in a separate thread. Pushes read lines on a queue to @@ -1699,7 +1702,7 @@ def remove_signing_keys(build_dir): re.compile(r'.*variant\.outputFile = .*'), re.compile(r'.*output\.outputFile = .*'), re.compile(r'.*\.readLine\(.*'), - ] + ] for root, dirs, files in os.walk(build_dir): if 'build.gradle' in files: path = os.path.join(root, 'build.gradle') @@ -1740,7 +1743,7 @@ def remove_signing_keys(build_dir): 'build.properties', 'default.properties', 'ant.properties', - ]: + ]: if propfile in files: path = os.path.join(root, propfile) diff --git a/fdroidserver/lint.py b/fdroidserver/lint.py index f6deefbb..8cf1bf61 100644 --- a/fdroidserver/lint.py +++ b/fdroidserver/lint.py @@ -33,7 +33,7 @@ regex_warnings = { "github URLs should always use https:// not http://"), (re.compile(r'.*[^sS]://code\.google\.com/.*'), "code.google.com URLs should always use https:// not http://"), - ], + ], 'Source Code': [ (re.compile(r'.*[^sS]://github\.com/.*'), "github URLs should always use https:// (not http://, git://, or git@)"), @@ -45,7 +45,7 @@ regex_warnings = { "dl.google.com URLs should always use https:// not http://"), (re.compile(r'.*[^sS]://gitorious\.org/.*'), "gitorious URLs should always use https:// (not http://, git://, or git@)"), - ], + ], 'Repo': [ (re.compile(r'.*[^sS]://code\.google\.com/.*'), "code.google.com URLs should always use https:// not http://"), @@ -61,7 +61,7 @@ regex_warnings = { "Apache SVN URLs should always use https:// (not http:// or svn://)"), (re.compile(r'.*[^sS]://svn\.code\.sf\.net/.*'), "Sourceforge SVN URLs should always use https:// (not http:// or svn://)"), - ], + ], 'Issue Tracker': [ (re.compile(r'.*code\.google\.com/p/[^/]+[/]*$'), "/issues is missing"), @@ -73,15 +73,15 @@ regex_warnings = { "github URLs should always use https:// not http://"), (re.compile(r'.*[^sS]://gitorious\.org/.*'), "gitorious URLs should always use https:// not http://"), - ], + ], 'License': [ (re.compile(r'^(|None|Unknown)$'), "No license specified"), - ], + ], 'Summary': [ (re.compile(r'^$'), "Summary yet to be filled"), - ], + ], 'Description': [ (re.compile(r'^No description available$'), "Description yet to be filled"), @@ -91,7 +91,7 @@ regex_warnings = { "Unnecessary leading space"), (re.compile(r'.*\s$'), "Unnecessary trailing space"), - ], + ], } regex_pedantic = { @@ -100,32 +100,32 @@ regex_pedantic = { "Appending .git is not necessary"), (re.compile(r'.*code\.google\.com/p/[^/]+/[^w]'), "Possible incorrect path appended to google code project site"), - ], + ], 'Source Code': [ (re.compile(r'.*github\.com/[^/]+/[^/]+\.git'), "Appending .git is not necessary"), (re.compile(r'.*code\.google\.com/p/[^/]+/source/.*'), "/source is often enough on its own"), - ], + ], 'Repo': [ (re.compile(r'^http://.*'), "use https:// if available"), (re.compile(r'^svn://.*'), "use https:// if available"), - ], + ], 'Issue Tracker': [ (re.compile(r'.*code\.google\.com/p/[^/]+/issues/.*'), "/issues is often enough on its own"), (re.compile(r'.*github\.com/[^/]+/[^/]+/issues/.*'), "/issues is often enough on its own"), - ], + ], 'Summary': [ (re.compile(r'.*\b(free software|open source)\b.*', re.IGNORECASE), "No need to specify that the app is Free Software"), (re.compile(r'.*[a-z0-9][.,!?][ $]'), "Punctuation should be avoided"), - ], - } + ], +} def main(): diff --git a/fdroidserver/metadata.py b/fdroidserver/metadata.py index 979a0159..1ba5a713 100644 --- a/fdroidserver/metadata.py +++ b/fdroidserver/metadata.py @@ -29,6 +29,7 @@ srclibs = None class MetaDataException(Exception): + def __init__(self, value): self.value = value @@ -69,7 +70,7 @@ app_defaults = OrderedDict([ ('Current Version', ''), ('Current Version Code', '0'), ('No Source Since', ''), - ]) +]) # In the order in which they are laid out on files @@ -102,7 +103,7 @@ flag_defaults = OrderedDict([ ('preassemble', []), ('antcommands', None), ('novcheck', False), - ]) +]) # Designates a metadata field type and checks that it matches @@ -222,7 +223,7 @@ valuetypes = { r"^(Tags|Tags .+|RepoManifest|RepoManifest/.+|RepoTrunk|HTTP|Static|None)$", None, ["Update Check Mode"], []) - } +} # Check an app's metadata information for integrity errors diff --git a/fdroidserver/stats.py b/fdroidserver/stats.py index 05c44d3f..ef80fe4d 100644 --- a/fdroidserver/stats.py +++ b/fdroidserver/stats.py @@ -149,7 +149,7 @@ def main(): 'apps': Counter(), 'appsver': Counter(), 'unknown': [] - } + } p = subprocess.Popen(["zcat", logfile], stdout=subprocess.PIPE) matches = (logsearch(line) for line in p.stdout) diff --git a/makebuildserver b/makebuildserver index c18c12d3..6dc317dc 100755 --- a/makebuildserver +++ b/makebuildserver @@ -98,7 +98,7 @@ cachefiles = [ ('Kivy-1.7.2.tar.gz', 'https://pypi.python.org/packages/source/K/Kivy/Kivy-1.7.2.tar.gz', '0485e2ef97b5086df886eb01f8303cb542183d2d71a159466f99ad6c8a1d03f1'), - ] +] if config['arch64']: cachefiles.extend([ diff --git a/setup.py b/setup.py index 669cfaee..a4bff8c8 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ setup(name='fdroidserver', 'examples/makebs.config.py', 'examples/opensc-fdroid.cfg', 'examples/fdroid-icon.png']), - ], + ], install_requires=[ 'mwclient', 'paramiko', @@ -28,12 +28,12 @@ setup(name='fdroidserver', 'apache-libcloud >= 0.14.1', 'pyasn1', 'pyasn1-modules', - ], + ], classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', 'Operating System :: POSIX', 'Topic :: Utilities', - ], + ], ) -- 2.30.2