Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: releaseAutomation.py

Issue 6047895316856832: Rewrite version number in the correct file during release automation (Closed)
Patch Set: Created Jan. 15, 2014, 3:04 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: releaseAutomation.py
===================================================================
--- a/releaseAutomation.py
+++ b/releaseAutomation.py
@@ -26,14 +26,13 @@
# Replace version number in metadata file "manually", ConfigParser will mess
# up the order of lines.
- handle = open(packager.getMetadataPath(baseDir, type), 'rb')
- rawMetadata = handle.read()
- handle.close()
- versionRegExp = re.compile(r'^(\s*version\s*=\s*).*', re.I | re.M)
- rawMetadata = re.sub(versionRegExp, r'\g<1>%s' % version, rawMetadata)
- handle = open(packager.getMetadataPath(baseDir, type), 'wb')
- handle.write(rawMetadata)
- handle.close()
+ with open(packager.readMetadata(baseDir, type).option_source("general", "version"), 'r+b') as file:
Wladimir Palant 2014/01/15 15:41:21 Style nit: Please keep the line length below 80 ch
+ rawMetadata = file.read()
+ rawMetadata = re.sub(r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version, rawMetadata, flags=re.I | re.M)
Wladimir Palant 2014/01/15 15:41:21 Style nit: Please split function parameters to two
+
+ file.seek(0)
+ file.write(rawMetadata)
+ file.truncate()
# Read extension name from locale data
import buildtools.packagerGecko as packagerGecko
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld