chiark / gitweb /
fix PEP8 "E302 expected 2 blank lines, found 1"
authorHans-Christoph Steiner <hans@eds.org>
Fri, 2 May 2014 03:39:33 +0000 (23:39 -0400)
committerHans-Christoph Steiner <hans@eds.org>
Tue, 6 May 2014 15:45:03 +0000 (11:45 -0400)
16 files changed:
fdroid
fdroidserver/build.py
fdroidserver/checkupdates.py
fdroidserver/common.py
fdroidserver/import.py
fdroidserver/init.py
fdroidserver/install.py
fdroidserver/lint.py
fdroidserver/metadata.py
fdroidserver/publish.py
fdroidserver/readmeta.py
fdroidserver/rewritemeta.py
fdroidserver/scanner.py
fdroidserver/server.py
fdroidserver/update.py
fdroidserver/verify.py

diff --git a/fdroid b/fdroid
index 1fc8b5f543e871689a5c35b9f1326a1f7c10fc1e..435ba1ba18e576c849cde481c37484d8ac6a0a56 100755 (executable)
--- a/fdroid
+++ b/fdroid
@@ -38,6 +38,7 @@ commands = {
         "server": "Interact with the repo HTTP server",
         }
 
+
 def print_help():
     print "usage: fdroid [-h|--help] <command> [<args>]"
     print
@@ -46,6 +47,7 @@ def print_help():
         print "   " + cmd + ' '*(15-len(cmd)) + summary
     print
 
+
 def main():
 
     if len(sys.argv) <= 1:
index d062cc9e4091850ad263b53b064e27bc09cf731c..4c7a5bd83c77c44c6fb8fe485486e8bf8c58ac93 100644 (file)
@@ -40,6 +40,7 @@ try:
 except ImportError:
     pass
 
+
 def get_builder_vm_id():
     vd = os.path.join('builder', '.vagrant')
     if os.path.isdir(vd):
index 29490fe7e1a5788d3663e42538befdae64320004..b6b52a274e602ce7bf020cfe5b949b177b561bab 100644 (file)
@@ -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
index ef0619a5b4d226f003549e9e22cb1ab4e815a0e7..0436b1f9e6313bef8a0558d72f1c7cbe6c8c9406 100644 (file)
@@ -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'.*<application.*').search
@@ -746,6 +767,7 @@ def fetch_real_name(app_dir, flavour):
                     return result
     return None
 
+
 # Retrieve the version name
 def version_name(original, app_dir, flavour):
     for f in manifest_paths(app_dir, flavour):
@@ -756,6 +778,7 @@ def version_name(original, app_dir, flavour):
             return string
     return original
 
+
 def get_library_references(root_dir):
     libraries = []
     proppath = os.path.join(root_dir, 'project.properties')
@@ -773,6 +796,7 @@ def get_library_references(root_dir):
             libraries.append(path)
     return libraries
 
+
 def ant_subprojects(root_dir):
     subprojects = get_library_references(root_dir)
     for subpath in subprojects:
@@ -783,6 +807,7 @@ def ant_subprojects(root_dir):
                 subprojects.insert(0, relp)
     return subprojects
 
+
 def remove_debuggable_flags(root_dir):
     # Remove forced debuggable flags
     logging.info("Removing debuggable flags")
@@ -793,6 +818,7 @@ def remove_debuggable_flags(root_dir):
             if p.returncode != 0:
                 raise BuildException("Failed to remove debuggable flags of %s" % path)
 
+
 # Extract some information from the AndroidManifest.xml at the given path.
 # Returns (version, vercode, package), any or all of which might be None.
 # All values returned are strings.
@@ -858,6 +884,7 @@ def parse_androidmanifests(paths):
 
     return (max_version, max_vercode, max_package)
 
+
 class BuildException(Exception):
     def __init__(self, value, detail=None):
         self.value = value
@@ -879,6 +906,7 @@ class BuildException(Exception):
             ret += "\n==== detail begin ====\n%s\n==== detail end ====" % self.detail.strip()
         return ret
 
+
 class VCSException(Exception):
     def __init__(self, value):
         self.value = value
@@ -886,6 +914,7 @@ class VCSException(Exception):
     def __str__(self):
         return repr(self.value)
 
+
 # Get the specified source library.
 # Returns the path to it. Normally this is the path to be used when referencing
 # it, which may be a subdirectory of the actual project. If you want the base
@@ -1212,6 +1241,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
 
     return (root_dir, srclibpaths)
 
+
 # Split and extend via globbing the paths from a field
 def getpaths(build_dir, build, field):
     paths = []
@@ -1224,6 +1254,7 @@ def getpaths(build_dir, build, field):
         paths += [r[len(build_dir)+1:] for r in glob.glob(full_path)]
     return paths
 
+
 # Scan the source code in the given directory (and all subdirectories)
 # and return the number of fatal problems encountered
 def scan_source(build_dir, root_dir, thisbuild):
@@ -1423,6 +1454,7 @@ class KnownApks:
         lst.reverse()
         return lst
 
+
 def isApkDebuggable(apkfile, config):
     """Returns True if the given apk file is debuggable
 
@@ -1463,13 +1495,16 @@ class AsynchronousFileReader(threading.Thread):
         '''Check whether there is no more content to expect.'''
         return not self.is_alive() and self._queue.empty()
 
+
 class PopenResult:
     returncode = None
     stdout = ''
 
+
 def SilentPopen(commands, cwd=None, shell=False):
     return FDroidPopen(commands, cwd=cwd, shell=shell, output=False)
 
+
 def FDroidPopen(commands, cwd=None, shell=False, output=True):
     """
     Run a command and capture the possibly huge output.
@@ -1509,6 +1544,7 @@ def FDroidPopen(commands, cwd=None, shell=False, output=True):
     result.returncode = p.returncode
     return result
 
+
 def remove_signing_keys(build_dir):
     comment = re.compile(r'[ ]*//')
     signing_configs = re.compile(r'^[\t ]*signingConfigs[ \t]*{[ \t]*$')
@@ -1570,12 +1606,14 @@ def remove_signing_keys(build_dir):
 
                 logging.info("Cleaned %s of keysigning configs at %s" % (propfile, path))
 
+
 def replace_config_vars(cmd):
     cmd = cmd.replace('$$SDK$$', config['sdk_path'])
     cmd = cmd.replace('$$NDK$$', config['ndk_path'])
     cmd = cmd.replace('$$MVN3$$', config['mvn3'])
     return cmd
 
+
 def place_srclib(root_dir, number, libpath):
     if not number:
         return
index 0ec73e8f7936f04eaa87f567c36fde075b085cbb..45925557d6fb6aa18fb4ea4f48022b7d6df38222 100644 (file)
@@ -28,6 +28,7 @@ import logging
 import common
 import metadata
 
+
 # Get the repo type and address from the given web page. The page is scanned
 # in a rather naive manner for 'git clone xxxx', 'hg clone xxxx', etc, and
 # when one of these is found it's assumed that's the information we want.
@@ -89,6 +90,7 @@ def getrepofrompage(url):
 config = None
 options = None
 
+
 def main():
 
     global config, options
index 7c1dd2437b535522ca7cd44849fc0e82e939695a..b0ca3faa62378290873aebe4f5397ac6bf570cfb 100644 (file)
@@ -35,6 +35,7 @@ from common import FDroidPopen, BuildException
 config = {}
 options = None
 
+
 def write_to_config(key, value):
     '''write a key/value to the local config.py'''
     with open('config.py', 'r') as f:
@@ -45,6 +46,7 @@ def write_to_config(key, value):
     with open('config.py', 'w') as f:
         f.writelines(data)
 
+
 def disable_in_config(key, value):
     '''write a key/value to the local config.py, then comment it out'''
     with open('config.py', 'r') as f:
index 0c511d18210a5a565a7628ac382c4bc69b85211a..d36234df4b3bb7569db86505b86b357f48d7a387 100644 (file)
@@ -30,6 +30,7 @@ from common import FDroidPopen
 options = None
 config = None
 
+
 def devices():
     p = FDroidPopen(["adb", "devices"])
     if p.returncode != 0:
index 67c20b779a4e93e338f671f20efb8f2ff9b238e8..4f26bb0fe72a9577e708e99c2a2be87fd16f9c2b 100644 (file)
@@ -119,6 +119,7 @@ regex_pedantic = {
         ],
 }
 
+
 def main():
 
     global config, options, appid, app_count, warn_count
index 55dcf5198d05403a8c12bf7a24a6b1e5e8530652..ca049646b2bbf82f8892886df021cb182f76d3be 100644 (file)
@@ -23,6 +23,7 @@ import glob
 import cgi
 import logging
 
+
 class MetaDataException(Exception):
     def __init__(self, value):
         self.value = value
@@ -183,6 +184,7 @@ valuetypes = {
         [])
 }
 
+
 # Check an app's metadata information for integrity errors
 def check_metadata(info):
     for k, t in valuetypes.iteritems():
@@ -200,6 +202,7 @@ def check_metadata(info):
                 elif k == 'bool':
                     build[attr] = False
 
+
 # Formatter for descriptions. Create an instance, and call parseline() with
 # each line of the description source from the metadata. At the end, call
 # end() and then text_plain, text_wiki and text_html will contain the result.
@@ -344,6 +347,7 @@ class DescriptionFormatter:
     def end(self):
         self.endcur()
 
+
 # Parse multiple lines of description as written in a metadata file, returning
 # a single string in plain text format.
 def description_plain(lines, linkres):
@@ -353,6 +357,7 @@ def description_plain(lines, linkres):
     ps.end()
     return ps.text_plain
 
+
 # Parse multiple lines of description as written in a metadata file, returning
 # a single string in wiki format. Used for the Maintainer Notes field as well,
 # because it's the same format.
@@ -363,6 +368,7 @@ def description_wiki(lines):
     ps.end()
     return ps.text_wiki
 
+
 # Parse multiple lines of description as written in a metadata file, returning
 # a single string in HTML format.
 def description_html(lines, linkres):
@@ -372,6 +378,7 @@ def description_html(lines, linkres):
     ps.end()
     return ps.text_html
 
+
 def parse_srclib(metafile, **kw):
 
     thisinfo = {}
@@ -407,6 +414,7 @@ def parse_srclib(metafile, **kw):
 
     return thisinfo
 
+
 # Read all metadata. Returns a list of 'app' objects (which are dictionaries as
 # returned by the parse_metadata function.
 def read_metadata(xref=True, package=None, store=True):
@@ -439,6 +447,7 @@ def read_metadata(xref=True, package=None, store=True):
 
     return apps
 
+
 # Get the type expected for a given metadata field.
 def metafieldtype(name):
     if name in ['Description', 'Maintainer Notes']:
@@ -455,6 +464,7 @@ def metafieldtype(name):
         return 'unknown'
     return 'string'
 
+
 def flagtype(name):
     if name in ['extlibs', 'srclibs', 'patch', 'rm', 'buildjni',
             'update', 'scanignore', 'scandelete']:
@@ -463,6 +473,7 @@ def flagtype(name):
         return 'script'
     return 'string'
 
+
 # Parse metadata for a single application.
 #
 #  'metafile' - the filename to read. The package id for the application comes
@@ -689,6 +700,7 @@ def parse_metadata(metafile):
 
     return thisinfo
 
+
 # Write a metadata file.
 #
 # 'dest'    - The path to the output file
index b9776eb013c7011f3bc5d905b3e95600d34af1fe..ee9638ee4dfcaad793e51e3f00f9fb999d24cd49 100644 (file)
@@ -33,6 +33,7 @@ from common import FDroidPopen, BuildException
 config = None
 options = None
 
+
 def main():
 
     global config, options
index 9145068bd49ed3ae58a7a85d9c06cfc76dda330e..c02108758660c832a05d290549b36612c7839fd1 100644 (file)
@@ -20,6 +20,7 @@
 import os
 import metadata
 
+
 def main():
 
     if not os.path.isdir('metadata'):
index 845f0f814559452064fa81348f3d5c0b32c3d9bc..84bdab466bbf2ed762df07b0449a54960a025de1 100644 (file)
@@ -26,6 +26,7 @@ import metadata
 config = None
 options = None
 
+
 def main():
 
     global config, options
index e54d7011e01c51ad43c78054680aa844cec8da05..c5e055ecb76df45358aa58f627702da4d1046128 100644 (file)
@@ -30,6 +30,7 @@ from common import VCSException
 config = None
 options = None
 
+
 def main():
 
     global config, options
index a817a91377b7951f1898221763648ad493163d1a..efec939d2292e1ba13de0274df77d897f09f7cb5 100644 (file)
@@ -28,6 +28,7 @@ import common
 config = None
 options = None
 
+
 def update_awsbucket(repo_section):
     '''
     Upload the contents of the directory `repo_section` (including
@@ -113,6 +114,7 @@ def update_awsbucket(repo_section):
         else:
             logging.info(' skipping ' + s3url)
 
+
 def update_serverwebroot(repo_section):
     rsyncargs = ['rsync', '-u', '-r', '--delete']
     if options.verbose:
@@ -133,6 +135,7 @@ def update_serverwebroot(repo_section):
                        [indexjar, config['serverwebroot'] + repo_section]) != 0:
         sys.exit(1)
 
+
 def main():
     global config, options
 
index ab540f9dc9ce364dfb48d21b1ab634a2721393cf..5afb3e0ebbac0132360d470629078b761e6f9f38 100644 (file)
@@ -37,25 +37,31 @@ import metadata
 from common import FDroidPopen
 from metadata import MetaDataException
 
+
 def get_densities():
     return ['640', '480', '320', '240', '160', '120']
 
+
 def dpi_to_px(density):
     return (int(density) * 48) / 160
 
+
 def px_to_dpi(px):
     return (int(px) * 160) / 48
 
+
 def get_icon_dir(repodir, density):
     if density is None:
         return os.path.join(repodir, "icons")
     return os.path.join(repodir, "icons-%s" % density)
 
+
 def get_icon_dirs(repodir):
     for density in get_densities():
         yield get_icon_dir(repodir, density)
     yield os.path.join(repodir, "icons")
 
+
 def update_wiki(apps, apks):
     """Update the wiki
 
@@ -257,6 +263,7 @@ def update_wiki(apps, apks):
     # Purge server cache to ensure counts are up to date
     site.pages['Repository Maintenance'].purge()
 
+
 def delete_disabled_builds(apps, apkcache, repodirs):
     """Delete disabled build outputs.
 
@@ -278,6 +285,7 @@ def delete_disabled_builds(apps, apkcache, repodirs):
                 if apkfilename in apkcache:
                     del apkcache[apkfilename]
 
+
 def resize_icon(iconpath, density):
 
     if not os.path.isfile(iconpath):
@@ -300,6 +308,7 @@ def resize_icon(iconpath, density):
     except Exception, e:
         logging.error("Failed resizing {0} - {1}".format(iconpath, e))
 
+
 def resize_all_icons(repodirs):
     """Resize all icons that exceed the max size
 
@@ -312,6 +321,7 @@ def resize_all_icons(repodirs):
             for iconpath in glob.glob(icon_glob):
                 resize_icon(iconpath, density)
 
+
 def scan_apks(apps, apkcache, repodir, knownapks):
     """Scan the apks in the given repo directory.
 
@@ -582,6 +592,7 @@ def scan_apks(apps, apkcache, repodir, knownapks):
 
 repo_pubkey_fingerprint = None
 
+
 def make_index(apps, apks, repodir, archive, categories):
     """Make a repo index.
 
@@ -861,6 +872,7 @@ def archive_old_apks(apps, apks, archapks, repodir, archivedir, defaultkeepversi
 config = None
 options = None
 
+
 def main():
 
     global config, options
index 1ef05af5ff756d3045d072be19803d7abf169943..1ee1859aef4af9edafaf4a1431a822bec776d336 100644 (file)
@@ -31,6 +31,7 @@ from common import FDroidPopen
 options = None
 config = None
 
+
 def main():
 
     global options, config