mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-06 07:20:29 +03:00
refactor App.get_last_build() to checkupdates
This function is only used in checkupdates, and removing it from the App class moves the App class one step closer to being a plain dict, which is a more Pythonic style.
This commit is contained in:
parent
8300ed051b
commit
74dddfd9fb
2 changed files with 11 additions and 13 deletions
|
|
@ -110,7 +110,7 @@ def check_tags(app, pattern):
|
||||||
|
|
||||||
vcs.gotorevision(None)
|
vcs.gotorevision(None)
|
||||||
|
|
||||||
last_build = app.get_last_build()
|
last_build = get_last_build_from_app(app)
|
||||||
|
|
||||||
try_init_submodules(app, last_build, vcs)
|
try_init_submodules(app, last_build, vcs)
|
||||||
|
|
||||||
|
|
@ -252,10 +252,7 @@ def check_repomanifest(app, branch=None):
|
||||||
elif repotype == 'bzr':
|
elif repotype == 'bzr':
|
||||||
vcs.gotorevision(None)
|
vcs.gotorevision(None)
|
||||||
|
|
||||||
last_build = metadata.Build()
|
last_build = get_last_build_from_app(app)
|
||||||
if app.get('Builds', []):
|
|
||||||
last_build = app.get('Builds', [])[-1]
|
|
||||||
|
|
||||||
try_init_submodules(app, last_build, vcs)
|
try_init_submodules(app, last_build, vcs)
|
||||||
|
|
||||||
hpak = None
|
hpak = None
|
||||||
|
|
@ -364,7 +361,7 @@ def possible_subdirs(app):
|
||||||
else:
|
else:
|
||||||
build_dir = Path('build') / app.id
|
build_dir = Path('build') / app.id
|
||||||
|
|
||||||
last_build = app.get_last_build()
|
last_build = get_last_build_from_app(app)
|
||||||
|
|
||||||
for d in dirs_with_manifest(build_dir):
|
for d in dirs_with_manifest(build_dir):
|
||||||
m_paths = common.manifest_paths(d, last_build.gradle)
|
m_paths = common.manifest_paths(d, last_build.gradle)
|
||||||
|
|
@ -399,7 +396,7 @@ def fetch_autoname(app, tag):
|
||||||
except VCSException:
|
except VCSException:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
last_build = app.get_last_build()
|
last_build = get_last_build_from_app(app)
|
||||||
|
|
||||||
logging.debug("...fetch auto name from " + str(build_dir))
|
logging.debug("...fetch auto name from " + str(build_dir))
|
||||||
new_name = None
|
new_name = None
|
||||||
|
|
@ -579,6 +576,13 @@ def checkupdates_app(app):
|
||||||
raise FDroidException("Git commit failed")
|
raise FDroidException("Git commit failed")
|
||||||
|
|
||||||
|
|
||||||
|
def get_last_build_from_app(app):
|
||||||
|
if app.get('Builds'):
|
||||||
|
return app['Builds'][-1]
|
||||||
|
else:
|
||||||
|
return metadata.Build()
|
||||||
|
|
||||||
|
|
||||||
def status_update_json(processed, failed):
|
def status_update_json(processed, failed):
|
||||||
"""Output a JSON file with metadata about this run."""
|
"""Output a JSON file with metadata about this run."""
|
||||||
logging.debug(_('Outputting JSON'))
|
logging.debug(_('Outputting JSON'))
|
||||||
|
|
|
||||||
|
|
@ -174,12 +174,6 @@ class App(dict):
|
||||||
else:
|
else:
|
||||||
raise AttributeError("No such attribute: " + name)
|
raise AttributeError("No such attribute: " + name)
|
||||||
|
|
||||||
def get_last_build(self):
|
|
||||||
if len(self.Builds) > 0:
|
|
||||||
return self.Builds[-1]
|
|
||||||
else:
|
|
||||||
return Build()
|
|
||||||
|
|
||||||
|
|
||||||
TYPE_STRING = 2
|
TYPE_STRING = 2
|
||||||
TYPE_BOOL = 3
|
TYPE_BOOL = 3
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue