1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-14 02:50:12 +01:00

App.get_last_build() method to replace duplicated code

Look @mvdan, I added a method to the App class!
This commit is contained in:
Hans-Christoph Steiner 2016-11-18 23:17:19 +01:00
parent 3db2c9869c
commit b91cdffe17
2 changed files with 9 additions and 9 deletions

View File

@ -109,9 +109,7 @@ def check_tags(app, pattern):
vcs.gotorevision(None)
last_build = metadata.Build()
if len(app.builds) > 0:
last_build = app.builds[-1]
last_build = app.get_last_build()
if last_build.submodules:
vcs.initsubmodules()
@ -322,9 +320,7 @@ def possible_subdirs(app):
else:
build_dir = os.path.join('build', app.id)
last_build = metadata.Build()
if len(app.builds) > 0:
last_build = app.builds[-1]
last_build = app.get_last_build()
for d in dirs_with_manifest(build_dir):
m_paths = common.manifest_paths(d, last_build.gradle)
@ -351,9 +347,7 @@ def fetch_autoname(app, tag):
except VCSException:
return None
last_build = metadata.Build()
if len(app.builds) > 0:
last_build = app.builds[-1]
last_build = app.get_last_build()
logging.debug("...fetch auto name from " + build_dir)
new_name = None

View File

@ -239,6 +239,12 @@ class App():
self.__dict__[k] = v
self._modified.add(k)
def get_last_build(self):
if len(self.builds) > 0:
return self.builds[-1]
else:
return Build()
TYPE_UNKNOWN = 0
TYPE_OBSOLETE = 1