From 3f4f7a544b99ebf8aae522eb1bb14ae0fafce8f3 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 1 May 2014 23:39:33 -0400 Subject: [PATCH] fix PEP8 "E302 expected 2 blank lines, found 1" --- fdroid | 2 ++ fdroidserver/build.py | 1 + fdroidserver/checkupdates.py | 5 +++++ fdroidserver/common.py | 38 ++++++++++++++++++++++++++++++++++++ fdroidserver/import.py | 2 ++ fdroidserver/init.py | 2 ++ fdroidserver/install.py | 1 + fdroidserver/lint.py | 1 + fdroidserver/metadata.py | 12 ++++++++++++ fdroidserver/publish.py | 1 + fdroidserver/readmeta.py | 1 + fdroidserver/rewritemeta.py | 1 + fdroidserver/scanner.py | 1 + fdroidserver/server.py | 3 +++ fdroidserver/update.py | 12 ++++++++++++ fdroidserver/verify.py | 1 + 16 files changed, 84 insertions(+) diff --git a/fdroid b/fdroid index 1fc8b5f5..435ba1ba 100755 --- a/fdroid +++ b/fdroid @@ -38,6 +38,7 @@ commands = { "server": "Interact with the repo HTTP server", } + def print_help(): print "usage: fdroid [-h|--help] []" print @@ -46,6 +47,7 @@ def print_help(): print " " + cmd + ' '*(15-len(cmd)) + summary print + def main(): if len(sys.argv) <= 1: diff --git a/fdroidserver/build.py b/fdroidserver/build.py index d062cc9e..4c7a5bd8 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -40,6 +40,7 @@ try: except ImportError: pass + def get_builder_vm_id(): vd = os.path.join('builder', '.vagrant') if os.path.isdir(vd): diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 29490fe7..b6b52a27 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -80,6 +80,7 @@ def check_http(app): msg = "Could not complete http check for app {0} due to unknown error: {1}".format(app['id'], traceback.format_exc()) return (None, msg) + # Check for a new version by looking at the tags in the source repo. # Whether this can be used reliably or not depends on # the development procedures used by the project's developers. Use it with @@ -158,6 +159,7 @@ def check_tags(app, pattern): msg = "Could not scan app {0} due to unknown error: {1}".format(app['id'], traceback.format_exc()) return (None, msg, None) + # Check for a new version by looking at the AndroidManifest.xml at the HEAD # of the source repo. Whether this can be used reliably or not depends on # the development procedures used by the project's developers. Use it with @@ -233,6 +235,7 @@ def check_repomanifest(app, branch=None): msg = "Could not scan app {0} due to unknown error: {1}".format(app['id'], traceback.format_exc()) return (None, msg) + def check_repotrunk(app, branch=None): try: @@ -263,6 +266,7 @@ def check_repotrunk(app, branch=None): msg = "Could not scan app {0} due to unknown error: {1}".format(app['id'], traceback.format_exc()) return (None, msg) + # Check for a new version by looking at the Google Play Store. # Returns (None, "a message") if this didn't work, or (version, None) for # the details of the current version. @@ -297,6 +301,7 @@ def check_gplay(app): config = None options = None + def main(): global config, options diff --git a/fdroidserver/common.py b/fdroidserver/common.py index ef0619a5..0436b1f9 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -36,6 +36,7 @@ import metadata config = None options = None + def get_default_config(): return { 'sdk_path': os.getenv("ANDROID_HOME"), @@ -58,6 +59,7 @@ def get_default_config(): 'keyaliases': {}, } + def read_config(opts, config_file='config.py'): """Read the repository config @@ -122,6 +124,7 @@ def read_config(opts, config_file='config.py'): return config + def test_sdk_exists(c): if c['sdk_path'] is None: # c['sdk_path'] is set to the value of ANDROID_HOME by default @@ -140,6 +143,7 @@ def test_sdk_exists(c): return False return True + def write_password_file(pwtype, password=None): ''' writes out passwords to a protected file instead of passing passwords as @@ -154,6 +158,7 @@ def write_password_file(pwtype, password=None): os.close(fd) config[pwtype + 'file'] = filename + # Given the arguments in the form of multiple appid:[vc] strings, this returns # a dictionary with the set of vercodes specified for each package. def read_pkg_args(args, allow_vercodes=False): @@ -175,6 +180,7 @@ def read_pkg_args(args, allow_vercodes=False): return vercodes + # On top of what read_pkg_args does, this returns the whole app metadata, but # limiting the builds list to the builds matching the vercodes specified. def read_app_args(args, allapps, allow_vercodes=False): @@ -213,6 +219,7 @@ def read_app_args(args, allapps, allow_vercodes=False): return apps + def has_extension(filename, extension): name, ext = os.path.splitext(filename) ext = ext.lower()[1:] @@ -220,6 +227,7 @@ def has_extension(filename, extension): apk_regex = None + def apknameinfo(filename): global apk_regex filename = os.path.basename(filename) @@ -232,12 +240,15 @@ def apknameinfo(filename): raise Exception("Invalid apk name: %s" % filename) return result + def getapkname(app, build): return "%s_%s.apk" % (app['id'], build['vercode']) + def getsrcname(app, build): return "%s_%s_src.tar.gz" % (app['id'], build['vercode']) + def getappname(app): if app['Name']: return app['Name'] @@ -245,9 +256,11 @@ def getappname(app): return app['Auto Name'] return app['id'] + def getcvname(app): return '%s (%s)' % (app['Current Version'], app['Current Version Code']) + def getvcs(vcstype, remote, local): if vcstype == 'git': return vcs_git(remote, local) @@ -265,12 +278,14 @@ def getvcs(vcstype, remote, local): return getsrclib(remote, 'build/srclib', raw=True) raise VCSException("Invalid vcs type " + vcstype) + def getsrclibvcs(name): srclib_path = os.path.join('srclibs', name + ".txt") if not os.path.exists(srclib_path): raise VCSException("Missing srclib " + name) return metadata.parse_srclib(srclib_path)['Repo Type'] + class vcs: def __init__(self, remote, local): @@ -356,6 +371,7 @@ class vcs: def getsrclib(self): return self.srclib + class vcs_git(vcs): def repotype(self): @@ -564,6 +580,7 @@ class vcs_gitsvn(vcs): return None return p.stdout.strip() + class vcs_svn(vcs): def repotype(self): @@ -606,6 +623,7 @@ class vcs_svn(vcs): return line[18:] return None + class vcs_hg(vcs): def repotype(self): @@ -678,6 +696,7 @@ class vcs_bzr(vcs): return [tag.split(' ')[0].strip() for tag in p.stdout.splitlines()] + def retrieve_string(app_dir, string, xmlfiles=None): res_dirs = [ @@ -708,6 +727,7 @@ def retrieve_string(app_dir, string, xmlfiles=None): return string.replace("\\'", "'") + # Return list of existing files that will be used to find the highest vercode def manifest_paths(app_dir, flavour): @@ -722,6 +742,7 @@ def manifest_paths(app_dir, flavour): return [path for path in possible_manifests if os.path.isfile(path)] + # Retrieve the package name. Returns the name, or None if not found. def fetch_real_name(app_dir, flavour): app_search = re.compile(r'.*