[checkupdates] UpdateCheckData tag for verocode if no regex

Use the tag as the version code if no regex was specified. This allows:

UpdateCheckData: '|||'

meaning the tag should be used for version code and name.
This commit is contained in:
Jochen Sprickerhof 2021-06-15 19:18:19 +02:00
parent 0c484f927e
commit cebdcdd67c
2 changed files with 13 additions and 4 deletions

View File

@ -171,11 +171,13 @@ def check_tags(app, pattern):
else:
filecontent = tag
m = re.search(codeex, filecontent)
if not m:
continue
vercode = tag
if codeex:
m = re.search(codeex, filecontent)
if not m:
continue
vercode = m.group(1).strip()
vercode = m.group(1).strip()
if filever:
if filever != '.':

View File

@ -265,6 +265,13 @@ class CheckupdatesTest(unittest.TestCase):
self.assertEqual(vername, '1.1.0')
self.assertEqual(vercode, '1')
app.UpdateCheckData = '|||'
vcs.latesttags.return_value = ['2']
with mock.patch('fdroidserver.common.getvcs', return_value=vcs):
vername, vercode, _tag = fdroidserver.checkupdates.check_tags(app, None)
self.assertEqual(vername, '2')
self.assertEqual(vercode, '2')
if __name__ == "__main__":
parser = optparse.OptionParser()