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: Adressed comments Created Jan. 15, 2014, 4 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,17 @@
# 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()
+ metadata = packager.readMetadata(baseDir, type)
+ with open(metadata.option_source("general", "version"), 'r+b') as file:
+ rawMetadata = file.read()
+ rawMetadata = re.sub(
+ r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version,
+ rawMetadata, flags=re.I | re.M
+ )
+
+ 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