Apply some autopep8-python2 suggestions

This commit is contained in:
Daniel Martí 2014-12-31 16:42:26 +01:00
parent e39602586f
commit 14f654fabc
8 changed files with 39 additions and 35 deletions

2
fdroid
View file

@ -40,7 +40,7 @@ commands = {
"scanner": "Scan the source code of a package", "scanner": "Scan the source code of a package",
"stats": "Update the stats of the repo", "stats": "Update the stats of the repo",
"server": "Interact with the repo HTTP server", "server": "Interact with the repo HTTP server",
} }
def print_help(): def print_help():

View file

@ -48,7 +48,7 @@ def get_builder_vm_id():
if os.path.isdir(vd): if os.path.isdir(vd):
# Vagrant 1.2 (and maybe 1.1?) it's a directory tree... # Vagrant 1.2 (and maybe 1.1?) it's a directory tree...
with open(os.path.join(vd, 'machines', 'default', with open(os.path.join(vd, 'machines', 'default',
'virtualbox', 'id')) as vf: 'virtualbox', 'id')) as vf:
id = vf.read() id = vf.read()
return id return id
else: else:
@ -71,7 +71,7 @@ def got_valid_builder_vm():
return True return True
# Vagrant 1.2 - the directory can exist, but the id can be missing... # Vagrant 1.2 - the directory can exist, but the id can be missing...
if not os.path.exists(os.path.join(vd, 'machines', 'default', if not os.path.exists(os.path.join(vd, 'machines', 'default',
'virtualbox', 'id')): 'virtualbox', 'id')):
return False return False
return True 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, 'common.py'), 'common.py')
ftp.put(os.path.join(serverpath, 'metadata.py'), 'metadata.py') ftp.put(os.path.join(serverpath, 'metadata.py'), 'metadata.py')
ftp.put(os.path.join(serverpath, '..', 'buildserver', ftp.put(os.path.join(serverpath, '..', 'buildserver',
'config.buildserver.py'), 'config.py') 'config.buildserver.py'), 'config.py')
ftp.chmod('config.py', 0o600) ftp.chmod('config.py', 0o600)
# Copy over the ID (head commit hash) of the fdroidserver in use... # 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), shutil.copyfile(os.path.join(homedir, fn),
os.path.join(metadir, fn)) os.path.join(metadir, fn))
subprocess.call(['jar', 'uf', os.path.abspath(src), 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 # Copy the unsigned apk to our destination directory for further
# processing (by publish.py)... # processing (by publish.py)...

View file

@ -391,6 +391,7 @@ def getsrclibvcs(name):
class vcs: class vcs:
def __init__(self, remote, local): def __init__(self, remote, local):
# svn, git-svn and bzr may require auth # svn, git-svn and bzr may require auth
@ -439,9 +440,8 @@ class vcs:
writeback = False writeback = False
else: else:
deleterepo = True deleterepo = True
logging.info( logging.info("Repository details for %s changed - deleting" % (
"Repository details for %s changed - deleting" % ( self.local))
self.local))
else: else:
deleterepo = True deleterepo = True
logging.info("Repository details for %s missing - deleting" % ( logging.info("Repository details for %s missing - deleting" % (
@ -592,8 +592,9 @@ class vcs_git(vcs):
def latesttags(self, alltags, number): def latesttags(self, alltags, number):
self.checkrepo() self.checkrepo()
p = FDroidPopen(['echo "' + '\n'.join(alltags) + '" | ' 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) cwd=self.local, shell=True, output=False)
return p.output.splitlines()[-number:] return p.output.splitlines()[-number:]
@ -1005,6 +1006,7 @@ def parse_androidmanifests(paths, ignoreversions=None):
class FDroidException(Exception): class FDroidException(Exception):
def __init__(self, value, detail=None): def __init__(self, value, detail=None):
self.value = value self.value = value
self.detail = detail self.detail = detail
@ -1415,7 +1417,7 @@ def scan_source(build_dir, root_dir, thisbuild):
re.compile(r'crashlytics', re.IGNORECASE), re.compile(r'crashlytics', re.IGNORECASE),
re.compile(r'ouya.*sdk', re.IGNORECASE), re.compile(r'ouya.*sdk', re.IGNORECASE),
re.compile(r'libspen23', re.IGNORECASE), re.compile(r'libspen23', re.IGNORECASE),
] ]
scanignore = getpaths(build_dir, thisbuild, 'scanignore') scanignore = getpaths(build_dir, thisbuild, 'scanignore')
scandelete = getpaths(build_dir, thisbuild, 'scandelete') scandelete = getpaths(build_dir, thisbuild, 'scandelete')
@ -1492,7 +1494,7 @@ def scan_source(build_dir, root_dir, thisbuild):
'application/java-archive', 'application/java-archive',
'application/octet-stream', 'application/octet-stream',
'binary', 'binary',
): ):
if has_extension(fp, 'apk'): if has_extension(fp, 'apk'):
removeproblem('APK file', fd, fp) removeproblem('APK file', fd, fp)
@ -1610,6 +1612,7 @@ def isApkDebuggable(apkfile, config):
class AsynchronousFileReader(threading.Thread): class AsynchronousFileReader(threading.Thread):
''' '''
Helper class to implement asynchronous reading of a file Helper class to implement asynchronous reading of a file
in a separate thread. Pushes read lines on a queue to 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'.*variant\.outputFile = .*'),
re.compile(r'.*output\.outputFile = .*'), re.compile(r'.*output\.outputFile = .*'),
re.compile(r'.*\.readLine\(.*'), re.compile(r'.*\.readLine\(.*'),
] ]
for root, dirs, files in os.walk(build_dir): for root, dirs, files in os.walk(build_dir):
if 'build.gradle' in files: if 'build.gradle' in files:
path = os.path.join(root, 'build.gradle') path = os.path.join(root, 'build.gradle')
@ -1740,7 +1743,7 @@ def remove_signing_keys(build_dir):
'build.properties', 'build.properties',
'default.properties', 'default.properties',
'ant.properties', 'ant.properties',
]: ]:
if propfile in files: if propfile in files:
path = os.path.join(root, propfile) path = os.path.join(root, propfile)

View file

@ -33,7 +33,7 @@ regex_warnings = {
"github URLs should always use https:// not http://"), "github URLs should always use https:// not http://"),
(re.compile(r'.*[^sS]://code\.google\.com/.*'), (re.compile(r'.*[^sS]://code\.google\.com/.*'),
"code.google.com URLs should always use https:// not http://"), "code.google.com URLs should always use https:// not http://"),
], ],
'Source Code': [ 'Source Code': [
(re.compile(r'.*[^sS]://github\.com/.*'), (re.compile(r'.*[^sS]://github\.com/.*'),
"github URLs should always use https:// (not http://, git://, or git@)"), "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://"), "dl.google.com URLs should always use https:// not http://"),
(re.compile(r'.*[^sS]://gitorious\.org/.*'), (re.compile(r'.*[^sS]://gitorious\.org/.*'),
"gitorious URLs should always use https:// (not http://, git://, or git@)"), "gitorious URLs should always use https:// (not http://, git://, or git@)"),
], ],
'Repo': [ 'Repo': [
(re.compile(r'.*[^sS]://code\.google\.com/.*'), (re.compile(r'.*[^sS]://code\.google\.com/.*'),
"code.google.com URLs should always use https:// not http://"), "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://)"), "Apache SVN URLs should always use https:// (not http:// or svn://)"),
(re.compile(r'.*[^sS]://svn\.code\.sf\.net/.*'), (re.compile(r'.*[^sS]://svn\.code\.sf\.net/.*'),
"Sourceforge SVN URLs should always use https:// (not http:// or svn://)"), "Sourceforge SVN URLs should always use https:// (not http:// or svn://)"),
], ],
'Issue Tracker': [ 'Issue Tracker': [
(re.compile(r'.*code\.google\.com/p/[^/]+[/]*$'), (re.compile(r'.*code\.google\.com/p/[^/]+[/]*$'),
"/issues is missing"), "/issues is missing"),
@ -73,15 +73,15 @@ regex_warnings = {
"github URLs should always use https:// not http://"), "github URLs should always use https:// not http://"),
(re.compile(r'.*[^sS]://gitorious\.org/.*'), (re.compile(r'.*[^sS]://gitorious\.org/.*'),
"gitorious URLs should always use https:// not http://"), "gitorious URLs should always use https:// not http://"),
], ],
'License': [ 'License': [
(re.compile(r'^(|None|Unknown)$'), (re.compile(r'^(|None|Unknown)$'),
"No license specified"), "No license specified"),
], ],
'Summary': [ 'Summary': [
(re.compile(r'^$'), (re.compile(r'^$'),
"Summary yet to be filled"), "Summary yet to be filled"),
], ],
'Description': [ 'Description': [
(re.compile(r'^No description available$'), (re.compile(r'^No description available$'),
"Description yet to be filled"), "Description yet to be filled"),
@ -91,7 +91,7 @@ regex_warnings = {
"Unnecessary leading space"), "Unnecessary leading space"),
(re.compile(r'.*\s$'), (re.compile(r'.*\s$'),
"Unnecessary trailing space"), "Unnecessary trailing space"),
], ],
} }
regex_pedantic = { regex_pedantic = {
@ -100,32 +100,32 @@ regex_pedantic = {
"Appending .git is not necessary"), "Appending .git is not necessary"),
(re.compile(r'.*code\.google\.com/p/[^/]+/[^w]'), (re.compile(r'.*code\.google\.com/p/[^/]+/[^w]'),
"Possible incorrect path appended to google code project site"), "Possible incorrect path appended to google code project site"),
], ],
'Source Code': [ 'Source Code': [
(re.compile(r'.*github\.com/[^/]+/[^/]+\.git'), (re.compile(r'.*github\.com/[^/]+/[^/]+\.git'),
"Appending .git is not necessary"), "Appending .git is not necessary"),
(re.compile(r'.*code\.google\.com/p/[^/]+/source/.*'), (re.compile(r'.*code\.google\.com/p/[^/]+/source/.*'),
"/source is often enough on its own"), "/source is often enough on its own"),
], ],
'Repo': [ 'Repo': [
(re.compile(r'^http://.*'), (re.compile(r'^http://.*'),
"use https:// if available"), "use https:// if available"),
(re.compile(r'^svn://.*'), (re.compile(r'^svn://.*'),
"use https:// if available"), "use https:// if available"),
], ],
'Issue Tracker': [ 'Issue Tracker': [
(re.compile(r'.*code\.google\.com/p/[^/]+/issues/.*'), (re.compile(r'.*code\.google\.com/p/[^/]+/issues/.*'),
"/issues is often enough on its own"), "/issues is often enough on its own"),
(re.compile(r'.*github\.com/[^/]+/[^/]+/issues/.*'), (re.compile(r'.*github\.com/[^/]+/[^/]+/issues/.*'),
"/issues is often enough on its own"), "/issues is often enough on its own"),
], ],
'Summary': [ 'Summary': [
(re.compile(r'.*\b(free software|open source)\b.*', re.IGNORECASE), (re.compile(r'.*\b(free software|open source)\b.*', re.IGNORECASE),
"No need to specify that the app is Free Software"), "No need to specify that the app is Free Software"),
(re.compile(r'.*[a-z0-9][.,!?][ $]'), (re.compile(r'.*[a-z0-9][.,!?][ $]'),
"Punctuation should be avoided"), "Punctuation should be avoided"),
], ],
} }
def main(): def main():

View file

@ -29,6 +29,7 @@ srclibs = None
class MetaDataException(Exception): class MetaDataException(Exception):
def __init__(self, value): def __init__(self, value):
self.value = value self.value = value
@ -69,7 +70,7 @@ app_defaults = OrderedDict([
('Current Version', ''), ('Current Version', ''),
('Current Version Code', '0'), ('Current Version Code', '0'),
('No Source Since', ''), ('No Source Since', ''),
]) ])
# In the order in which they are laid out on files # In the order in which they are laid out on files
@ -102,7 +103,7 @@ flag_defaults = OrderedDict([
('preassemble', []), ('preassemble', []),
('antcommands', None), ('antcommands', None),
('novcheck', False), ('novcheck', False),
]) ])
# Designates a metadata field type and checks that it matches # 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, r"^(Tags|Tags .+|RepoManifest|RepoManifest/.+|RepoTrunk|HTTP|Static|None)$", None,
["Update Check Mode"], ["Update Check Mode"],
[]) [])
} }
# Check an app's metadata information for integrity errors # Check an app's metadata information for integrity errors

View file

@ -149,7 +149,7 @@ def main():
'apps': Counter(), 'apps': Counter(),
'appsver': Counter(), 'appsver': Counter(),
'unknown': [] 'unknown': []
} }
p = subprocess.Popen(["zcat", logfile], stdout=subprocess.PIPE) p = subprocess.Popen(["zcat", logfile], stdout=subprocess.PIPE)
matches = (logsearch(line) for line in p.stdout) matches = (logsearch(line) for line in p.stdout)

View file

@ -98,7 +98,7 @@ cachefiles = [
('Kivy-1.7.2.tar.gz', ('Kivy-1.7.2.tar.gz',
'https://pypi.python.org/packages/source/K/Kivy/Kivy-1.7.2.tar.gz', 'https://pypi.python.org/packages/source/K/Kivy/Kivy-1.7.2.tar.gz',
'0485e2ef97b5086df886eb01f8303cb542183d2d71a159466f99ad6c8a1d03f1'), '0485e2ef97b5086df886eb01f8303cb542183d2d71a159466f99ad6c8a1d03f1'),
] ]
if config['arch64']: if config['arch64']:
cachefiles.extend([ cachefiles.extend([

View file

@ -19,7 +19,7 @@ setup(name='fdroidserver',
'examples/makebs.config.py', 'examples/makebs.config.py',
'examples/opensc-fdroid.cfg', 'examples/opensc-fdroid.cfg',
'examples/fdroid-icon.png']), 'examples/fdroid-icon.png']),
], ],
install_requires=[ install_requires=[
'mwclient', 'mwclient',
'paramiko', 'paramiko',
@ -28,12 +28,12 @@ setup(name='fdroidserver',
'apache-libcloud >= 0.14.1', 'apache-libcloud >= 0.14.1',
'pyasn1', 'pyasn1',
'pyasn1-modules', 'pyasn1-modules',
], ],
classifiers=[ classifiers=[
'Development Status :: 3 - Alpha', 'Development Status :: 3 - Alpha',
'Intended Audience :: Developers', 'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Operating System :: POSIX', 'Operating System :: POSIX',
'Topic :: Utilities', 'Topic :: Utilities',
], ],
) )