mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 23:42:37 +03:00
Use shorter and non-redundant 'or' clauses for 'if True else' assignments
This commit is contained in:
parent
eaf3216e40
commit
3dbf99a7f2
5 changed files with 10 additions and 10 deletions
|
@ -90,7 +90,7 @@ def check_tags(app, pattern):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
appid = app['Update Check Name'] if app['Update Check Name'] else app['id']
|
appid = app['Update Check Name'] or app['id']
|
||||||
if app['Repo Type'] == 'srclib':
|
if app['Repo Type'] == 'srclib':
|
||||||
build_dir = os.path.join('build', 'srclib', app['Repo'])
|
build_dir = os.path.join('build', 'srclib', app['Repo'])
|
||||||
repotype = common.getsrclibvcs(app['Repo'])
|
repotype = common.getsrclibvcs(app['Repo'])
|
||||||
|
@ -174,7 +174,7 @@ def check_repomanifest(app, branch=None):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
appid = app['Update Check Name'] if app['Update Check Name'] else app['id']
|
appid = app['Update Check Name'] or app['id']
|
||||||
if app['Repo Type'] == 'srclib':
|
if app['Repo Type'] == 'srclib':
|
||||||
build_dir = os.path.join('build', 'srclib', app['Repo'])
|
build_dir = os.path.join('build', 'srclib', app['Repo'])
|
||||||
repotype = common.getsrclibvcs(app['Repo'])
|
repotype = common.getsrclibvcs(app['Repo'])
|
||||||
|
@ -312,7 +312,7 @@ def dirs_with_manifest(startdir):
|
||||||
# subdir relative to the build dir if found, None otherwise.
|
# subdir relative to the build dir if found, None otherwise.
|
||||||
def check_changed_subdir(app):
|
def check_changed_subdir(app):
|
||||||
|
|
||||||
appid = app['Update Check Name'] if app['Update Check Name'] else app['id']
|
appid = app['Update Check Name'] or app['id']
|
||||||
if app['Repo Type'] == 'srclib':
|
if app['Repo Type'] == 'srclib':
|
||||||
build_dir = os.path.join('build', 'srclib', app['Repo'])
|
build_dir = os.path.join('build', 'srclib', app['Repo'])
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -490,7 +490,7 @@ class vcs_git(vcs):
|
||||||
self.refreshed = True
|
self.refreshed = True
|
||||||
# origin/HEAD is the HEAD of the remote, e.g. the "default branch" on
|
# origin/HEAD is the HEAD of the remote, e.g. the "default branch" on
|
||||||
# a github repo. Most of the time this is the same as origin/master.
|
# a github repo. Most of the time this is the same as origin/master.
|
||||||
rev = str(rev if rev else 'origin/HEAD')
|
rev = rev or 'origin/HEAD'
|
||||||
p = SilentPopen(['git', 'checkout', '-f', rev], cwd=self.local)
|
p = SilentPopen(['git', 'checkout', '-f', rev], cwd=self.local)
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise VCSException("Git checkout of '%s' failed" % rev, p.output)
|
raise VCSException("Git checkout of '%s' failed" % rev, p.output)
|
||||||
|
@ -608,7 +608,7 @@ class vcs_gitsvn(vcs):
|
||||||
raise VCSException("Git svn rebase failed", p.output)
|
raise VCSException("Git svn rebase failed", p.output)
|
||||||
self.refreshed = True
|
self.refreshed = True
|
||||||
|
|
||||||
rev = str(rev if rev else 'master')
|
rev = rev or 'master'
|
||||||
if rev:
|
if rev:
|
||||||
nospaces_rev = rev.replace(' ', '%20')
|
nospaces_rev = rev.replace(' ', '%20')
|
||||||
# Try finding a svn tag
|
# Try finding a svn tag
|
||||||
|
@ -723,7 +723,7 @@ class vcs_hg(vcs):
|
||||||
raise VCSException("Hg pull failed", p.output)
|
raise VCSException("Hg pull failed", p.output)
|
||||||
self.refreshed = True
|
self.refreshed = True
|
||||||
|
|
||||||
rev = str(rev if rev else 'default')
|
rev = rev or 'default'
|
||||||
if not rev:
|
if not rev:
|
||||||
return
|
return
|
||||||
p = SilentPopen(['hg', 'update', '-C', rev], cwd=self.local)
|
p = SilentPopen(['hg', 'update', '-C', rev], cwd=self.local)
|
||||||
|
|
|
@ -285,8 +285,8 @@ def main():
|
||||||
|
|
||||||
# Create a build line...
|
# Create a build line...
|
||||||
build = {}
|
build = {}
|
||||||
build['version'] = version if version else '?'
|
build['version'] = version or '?'
|
||||||
build['vercode'] = vercode if vercode else '?'
|
build['vercode'] = vercode or '?'
|
||||||
build['commit'] = '?'
|
build['commit'] = '?'
|
||||||
build['disable'] = 'Generated by import.py - check/set version fields and commit id'
|
build['disable'] = 'Generated by import.py - check/set version fields and commit id'
|
||||||
if options.subdir:
|
if options.subdir:
|
||||||
|
|
|
@ -189,7 +189,7 @@ def main():
|
||||||
|
|
||||||
# Redundant summaries
|
# Redundant summaries
|
||||||
summary = app['Summary']
|
summary = app['Summary']
|
||||||
name = str(app['Name'] if app['Name'] else app['Auto Name'])
|
name = app['Name'] or app['Auto Name']
|
||||||
if summary and name:
|
if summary and name:
|
||||||
summary_l = summary.lower()
|
summary_l = summary.lower()
|
||||||
name_l = name.lower()
|
name_l = name.lower()
|
||||||
|
|
|
@ -794,7 +794,7 @@ def write_metadata(dest, app):
|
||||||
mf.write("%s\n" % comment)
|
mf.write("%s\n" % comment)
|
||||||
written += 1
|
written += 1
|
||||||
if written > 0:
|
if written > 0:
|
||||||
logging.debug("...writing comments for " + (key if key else 'EOF'))
|
logging.debug("...writing comments for " + (key or 'EOF'))
|
||||||
|
|
||||||
def writefield(field, value=None):
|
def writefield(field, value=None):
|
||||||
writecomments(field)
|
writecomments(field)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue