From dcc63e9824fc4474170a88cbfb0021c4e4d741ea Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Fri, 19 Sep 2014 11:05:18 -0700 Subject: [PATCH] release.py: Fix bumping setup.py version --- extra/release.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extra/release.py b/extra/release.py index 0a1730e4a..7fb7cd7ed 100755 --- a/extra/release.py +++ b/extra/release.py @@ -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))