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 |