Skip to content

Commit

Permalink
update_pkgrel: support quoted pkgrel, fixes #40
Browse files Browse the repository at this point in the history
  • Loading branch information
lilydjwg committed Jan 27, 2017
1 parent 0989c05 commit fc69bb3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lilaclib.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ def update_pkgrel(rel=None):
def replacer(m):
nonlocal rel
if rel is None:
rel = int(float(m.group())) + 1
rel = int(float(m.group(1))) + 1
return str(rel)

pkgbuild = re.sub(r'(?<=^pkgrel=)[\d.]+', replacer, pkgbuild, count=1, flags=re.MULTILINE)
pkgbuild = re.sub(r'''(?<=^pkgrel=)['"]?([\d.])+['"]?''', replacer, pkgbuild, count=1, flags=re.MULTILINE)
with open('PKGBUILD', 'w') as f:
f.write(pkgbuild)
logger.info('pkgrel updated to %s', rel)
Expand Down

0 comments on commit fc69bb3

Please sign in to comment.