[Pkg-mozext-commits] [adblock-plus] 413/464: Rewrite version number in the correct file during release automation.

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 20:44:39 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus.

commit 9b50387fa1ae39f7e3bfdbf3726d085f79cb98c4
Author: Sebastian Noack <sebastian at adblockplug.org>
Date:   Wed Jan 15 16:54:28 2014 +0100

    Rewrite version number in the correct file during release automation.
---
 releaseAutomation.py | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/releaseAutomation.py b/releaseAutomation.py
index 87d92b8..da63ff0 100644
--- a/releaseAutomation.py
+++ b/releaseAutomation.py
@@ -26,14 +26,17 @@ def run(baseDir, type, version, keyFile, downloadsRepo):
 
   # 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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list