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",
"stats": "Update the stats of the repo",
"server": "Interact with the repo HTTP server",
}
}
def print_help():

View File

@ -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)...

View File

@ -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)

View File

@ -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():

View File

@ -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

View File

@ -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)

View File

@ -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([

View File

@ -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',
],
],
)