fix PEP8 "E226 missing whitespace around arithmetic operator"

This commit is contained in:
Hans-Christoph Steiner 2014-05-06 13:56:44 -04:00
parent 0e00b36db5
commit 37d6d87ff7
8 changed files with 25 additions and 23 deletions

2
fdroid
View file

@ -44,7 +44,7 @@ def print_help():
print print
print "Valid commands are:" print "Valid commands are:"
for cmd, summary in commands.items(): for cmd, summary in commands.items():
print " " + cmd + ' '*(15-len(cmd)) + summary print " " + cmd + ' ' * (15 - len(cmd)) + summary
print print

View file

@ -604,12 +604,14 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
if 'target' in thisbuild: if 'target' in thisbuild:
target = thisbuild["target"].split('-')[1] target = thisbuild["target"].split('-')[1]
FDroidPopen(['sed', '-i', FDroidPopen(['sed', '-i',
's@<platform>[0-9]*</platform>@<platform>'+target+'</platform>@g', 's@<platform>[0-9]*</platform>@<platform>'
+ target + '</platform>@g',
'pom.xml'], 'pom.xml'],
cwd=root_dir) cwd=root_dir)
if '@' in thisbuild['maven']: if '@' in thisbuild['maven']:
FDroidPopen(['sed', '-i', FDroidPopen(['sed', '-i',
's@<platform>[0-9]*</platform>@<platform>'+target+'</platform>@g', 's@<platform>[0-9]*</platform>@<platform>'
+ target + '</platform>@g',
'pom.xml'], 'pom.xml'],
cwd=maven_dir) cwd=maven_dir)
@ -702,7 +704,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
if flavours_cmd: if flavours_cmd:
flavours_cmd = flavours_cmd[0].upper() + flavours_cmd[1:] flavours_cmd = flavours_cmd[0].upper() + flavours_cmd[1:]
commands += ['assemble'+flavours_cmd+'Release'] commands += ['assemble' + flavours_cmd + 'Release']
p = FDroidPopen(commands, cwd=gradle_dir) p = FDroidPopen(commands, cwd=gradle_dir)
@ -753,7 +755,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
else: else:
name = '-'.join([basename, '-'.join(flavours), 'release', 'unsigned']) name = '-'.join([basename, '-'.join(flavours), 'release', 'unsigned'])
dd = os.path.normpath(dd) dd = os.path.normpath(dd)
src = os.path.join(dd, 'build', 'apk', name+'.apk') src = os.path.join(dd, 'build', 'apk', name + '.apk')
elif thisbuild['type'] == 'ant': elif thisbuild['type'] == 'ant':
stdout_apk = '\n'.join([ stdout_apk = '\n'.join([
line for line in p.stdout.splitlines() if '.apk' in line]) line for line in p.stdout.splitlines() if '.apk' in line])

View file

@ -183,7 +183,7 @@ def check_repomanifest(app, branch=None):
if repotype == 'git': if repotype == 'git':
if branch: if branch:
branch = 'origin/'+branch branch = 'origin/' + branch
vcs.gotorevision(branch) vcs.gotorevision(branch)
elif repotype == 'git-svn': elif repotype == 'git-svn':
vcs.gotorevision(branch) vcs.gotorevision(branch)

View file

@ -460,7 +460,7 @@ class vcs_git(vcs):
def latesttags(self, alltags, number): def latesttags(self, alltags, number):
self.checkrepo() self.checkrepo()
p = SilentPopen(['echo "'+'\n'.join(alltags)+'" | \ p = SilentPopen(['echo "' + '\n'.join(alltags) + '" | \
xargs -I@ git log --format=format:"%at @%n" -1 @ | \ xargs -I@ git log --format=format:"%at @%n" -1 @ | \
sort -n | awk \'{print $2}\''], sort -n | awk \'{print $2}\''],
cwd=self.local, shell=True) cwd=self.local, shell=True)
@ -653,7 +653,7 @@ class vcs_hg(vcs):
p = SilentPopen(['hg', 'purge', '--all'], cwd=self.local) p = SilentPopen(['hg', 'purge', '--all'], cwd=self.local)
# Also delete untracked files, we have to enable purge extension for that: # Also delete untracked files, we have to enable purge extension for that:
if "'purge' is provided by the following extension" in p.stdout: if "'purge' is provided by the following extension" in p.stdout:
with open(self.local+"/.hg/hgrc", "a") as myfile: with open(self.local + "/.hg/hgrc", "a") as myfile:
myfile.write("\n[extensions]\nhgext.purge=\n") myfile.write("\n[extensions]\nhgext.purge=\n")
p = SilentPopen(['hg', 'purge', '--all'], cwd=self.local) p = SilentPopen(['hg', 'purge', '--all'], cwd=self.local)
if p.returncode != 0: if p.returncode != 0:
@ -713,9 +713,9 @@ def retrieve_string(app_dir, string, xmlfiles=None):
string_search = None string_search = None
if string.startswith('@string/'): if string.startswith('@string/'):
string_search = re.compile(r'.*"'+string[8:]+'".*?>([^<]+?)<.*').search string_search = re.compile(r'.*"' + string[8:] + '".*?>([^<]+?)<.*').search
elif string.startswith('&') and string.endswith(';'): elif string.startswith('&') and string.endswith(';'):
string_search = re.compile(r'.*<!ENTITY.*'+string[1:-1]+'.*?"([^"]+?)".*>').search string_search = re.compile(r'.*<!ENTITY.*' + string[1:-1] + '.*?"([^"]+?)".*>').search
if string_search is not None: if string_search is not None:
for xmlfile in xmlfiles: for xmlfile in xmlfiles:
@ -1112,14 +1112,14 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
if 'target' in build: if 'target' in build:
n = build["target"].split('-')[1] n = build["target"].split('-')[1]
FDroidPopen(['sed', '-i', FDroidPopen(['sed', '-i',
's@compileSdkVersion *[0-9]*@compileSdkVersion '+n+'@g', 's@compileSdkVersion *[0-9]*@compileSdkVersion ' + n + '@g',
'build.gradle'], 'build.gradle'],
cwd=root_dir) cwd=root_dir)
if '@' in build['gradle']: if '@' in build['gradle']:
gradle_dir = os.path.join(root_dir, build['gradle'].split('@', 1)[1]) gradle_dir = os.path.join(root_dir, build['gradle'].split('@', 1)[1])
gradle_dir = os.path.normpath(gradle_dir) gradle_dir = os.path.normpath(gradle_dir)
FDroidPopen(['sed', '-i', FDroidPopen(['sed', '-i',
's@compileSdkVersion *[0-9]*@compileSdkVersion '+n+'@g', 's@compileSdkVersion *[0-9]*@compileSdkVersion ' + n + '@g',
'build.gradle'], 'build.gradle'],
cwd=gradle_dir) cwd=gradle_dir)
@ -1258,7 +1258,7 @@ def getpaths(build_dir, build, field):
p = p.strip() p = p.strip()
full_path = os.path.join(build_dir, p) full_path = os.path.join(build_dir, p)
full_path = os.path.normpath(full_path) full_path = os.path.normpath(full_path)
paths += [r[len(build_dir)+1:] for r in glob.glob(full_path)] paths += [r[len(build_dir) + 1:] for r in glob.glob(full_path)]
return paths return paths
@ -1335,7 +1335,7 @@ def scan_source(build_dir, root_dir, thisbuild):
# Path (relative) to the file # Path (relative) to the file
fp = os.path.join(r, curfile) fp = os.path.join(r, curfile)
fd = fp[len(build_dir)+1:] fd = fp[len(build_dir) + 1:]
# Check if this file has been explicitly excluded from scanning # Check if this file has been explicitly excluded from scanning
if toignore(fd): if toignore(fd):

View file

@ -293,7 +293,7 @@ class DescriptionFormatter:
urltext = url urltext = url
linkified_html += '<a href="' + url + '">' + cgi.escape(urltext) + '</a>' linkified_html += '<a href="' + url + '">' + cgi.escape(urltext) + '</a>'
linkified_plain += urltext linkified_plain += urltext
txt = txt[index+2:] txt = txt[index + 2:]
else: else:
index = txt.find("]") index = txt.find("]")
if index == -1: if index == -1:
@ -309,7 +309,7 @@ class DescriptionFormatter:
linkified_plain += urltxt linkified_plain += urltxt
if urltxt != url: if urltxt != url:
linkified_plain += ' (' + url + ')' linkified_plain += ' (' + url + ')'
txt = txt[index+1:] txt = txt[index + 1:]
def addtext(self, txt): def addtext(self, txt):
p, h = self.linkify(txt) p, h = self.linkify(txt)
@ -550,7 +550,7 @@ def parse_metadata(metafile):
commit = 'unknown - see disabled' commit = 'unknown - see disabled'
index = parts[2].rfind('at ') index = parts[2].rfind('at ')
if index != -1: if index != -1:
commit = parts[2][index+3:] commit = parts[2][index + 3:]
if commit.endswith(')'): if commit.endswith(')'):
commit = commit[:-1] commit = commit[:-1]
thisbuild['commit'] = commit thisbuild['commit'] = commit
@ -629,9 +629,9 @@ def parse_metadata(metafile):
try: try:
field, value = line.split(':', 1) field, value = line.split(':', 1)
except ValueError: except ValueError:
raise MetaDataException("Invalid metadata in "+linedesc) raise MetaDataException("Invalid metadata in " + linedesc)
if field != field.strip() or value != value.strip(): if field != field.strip() or value != value.strip():
raise MetaDataException("Extra spacing found in "+linedesc) raise MetaDataException("Extra spacing found in " + linedesc)
# Translate obsolete fields... # Translate obsolete fields...
if field == 'Market Version': if field == 'Market Version':

View file

@ -47,7 +47,7 @@ def main():
for app in apps: for app in apps:
logging.info("Writing " + app['id']) logging.info("Writing " + app['id'])
metadata.write_metadata(os.path.join('metadata', app['id'])+'.txt', app) metadata.write_metadata(os.path.join('metadata', app['id']) + '.txt', app)
logging.info("Finished.") logging.info("Finished.")

View file

@ -754,9 +754,9 @@ def make_index(apps, apks, repodir, archive, categories):
# Check for duplicates - they will make the client unhappy... # Check for duplicates - they will make the client unhappy...
for i in range(len(apklist) - 1): for i in range(len(apklist) - 1):
if apklist[i]['versioncode'] == apklist[i+1]['versioncode']: if apklist[i]['versioncode'] == apklist[i + 1]['versioncode']:
logging.critical("duplicate versions: '%s' - '%s'" % ( logging.critical("duplicate versions: '%s' - '%s'" % (
apklist[i]['apkname'], apklist[i+1]['apkname'])) apklist[i]['apkname'], apklist[i + 1]['apkname']))
sys.exit(1) sys.exit(1)
for apk in apklist: for apk in apklist:

View file

@ -20,7 +20,7 @@ setup(name='fdroidserver',
scripts=['fdroid', 'fd-commit'], scripts=['fdroid', 'fd-commit'],
data_files=[ data_files=[
(sys.prefix + '/share/doc/fdroidserver/examples', (sys.prefix + '/share/doc/fdroidserver/examples',
[ 'buildserver/config.buildserver.py', ['buildserver/config.buildserver.py',
'examples/config.py', 'examples/config.py',
'examples/makebs.config.py', 'examples/makebs.config.py',
'examples/opensc-fdroid.cfg', 'examples/opensc-fdroid.cfg',