mirror of
https://github.com/beetbox/beets.git
synced 2025-12-28 11:32:30 +01:00
release.py: Fix bumping setup.py version
This commit is contained in:
parent
6ac568c11b
commit
dcc63e9824
1 changed files with 6 additions and 1 deletions
|
|
@ -55,7 +55,7 @@ VERSION_LOCS = [
|
|||
os.path.join(BASE, 'setup.py'),
|
||||
[
|
||||
(
|
||||
r'version\s*=\s*[\'"]([0-9\.]+)[\'"]',
|
||||
r'\s*version\s*=\s*[\'"]([0-9\.]+)[\'"]',
|
||||
" version='{version}',",
|
||||
)
|
||||
]
|
||||
|
|
@ -77,6 +77,7 @@ def bump_version(version):
|
|||
# Read and transform the file.
|
||||
out_lines = []
|
||||
with open(filename) as f:
|
||||
found = False
|
||||
for line in f:
|
||||
for pattern, template in locations:
|
||||
match = re.match(pattern, line)
|
||||
|
|
@ -96,12 +97,16 @@ def bump_version(version):
|
|||
minor=minor,
|
||||
) + '\n')
|
||||
|
||||
found = True
|
||||
break
|
||||
|
||||
else:
|
||||
# Normal line.
|
||||
out_lines.append(line)
|
||||
|
||||
if not found:
|
||||
print("No pattern found in {}".format(filename))
|
||||
|
||||
# Write the file back.
|
||||
with open(filename, 'w') as f:
|
||||
f.write(''.join(out_lines))
|
||||
|
|
|
|||
Loading…
Reference in a new issue