mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 06:50:29 +03: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:
parent
3db2c9869c
commit
b91cdffe17
2 changed files with 9 additions and 9 deletions
|
|
@ -109,9 +109,7 @@ def check_tags(app, pattern):
|
||||||
|
|
||||||
vcs.gotorevision(None)
|
vcs.gotorevision(None)
|
||||||
|
|
||||||
last_build = metadata.Build()
|
last_build = app.get_last_build()
|
||||||
if len(app.builds) > 0:
|
|
||||||
last_build = app.builds[-1]
|
|
||||||
|
|
||||||
if last_build.submodules:
|
if last_build.submodules:
|
||||||
vcs.initsubmodules()
|
vcs.initsubmodules()
|
||||||
|
|
@ -322,9 +320,7 @@ def possible_subdirs(app):
|
||||||
else:
|
else:
|
||||||
build_dir = os.path.join('build', app.id)
|
build_dir = os.path.join('build', app.id)
|
||||||
|
|
||||||
last_build = metadata.Build()
|
last_build = app.get_last_build()
|
||||||
if len(app.builds) > 0:
|
|
||||||
last_build = app.builds[-1]
|
|
||||||
|
|
||||||
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)
|
||||||
|
|
@ -351,9 +347,7 @@ def fetch_autoname(app, tag):
|
||||||
except VCSException:
|
except VCSException:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
last_build = metadata.Build()
|
last_build = app.get_last_build()
|
||||||
if len(app.builds) > 0:
|
|
||||||
last_build = app.builds[-1]
|
|
||||||
|
|
||||||
logging.debug("...fetch auto name from " + build_dir)
|
logging.debug("...fetch auto name from " + build_dir)
|
||||||
new_name = None
|
new_name = None
|
||||||
|
|
|
||||||
|
|
@ -239,6 +239,12 @@ class App():
|
||||||
self.__dict__[k] = v
|
self.__dict__[k] = v
|
||||||
self._modified.add(k)
|
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_UNKNOWN = 0
|
||||||
TYPE_OBSOLETE = 1
|
TYPE_OBSOLETE = 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue