[Pkg-mozext-commits] [adblock-plus] 389/464: Use checked versions of subprocess calls, error out in case of failure instead of continuing

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 20:44:36 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 e22d0a7e32ab80701275831ebdc3166ce937c81b
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Thu Jul 4 11:03:13 2013 +0200

    Use checked versions of subprocess calls, error out in case of failure instead of continuing
---
 .hgsubstate               |  2 +-
 build.py                  |  4 ++--
 packager.py               |  4 ++--
 releaseAutomationGecko.py | 14 +++++++-------
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/.hgsubstate b/.hgsubstate
index 8dca57f..6ecb639 100644
--- a/.hgsubstate
+++ b/.hgsubstate
@@ -1 +1 @@
-99459e875916b5fc64ca222f131a302121b870a6 jshydra
+6737deead473f5b2290c3e039e935669d732ded1 jshydra
diff --git a/build.py b/build.py
index 6bef565..9fbca4a 100644
--- a/build.py
+++ b/build.py
@@ -365,7 +365,7 @@ def generateDocs(baseDir, scriptName, opts, args, type):
   if toolkit == None:
     toolkit = os.path.join(baseDir, 'jsdoc-toolkit')
     if not os.path.exists(toolkit):
-      subprocess.Popen(['hg', 'clone', 'https://hg.adblockplus.org/jsdoc-toolkit/', toolkit]).communicate()
+      subprocess.check_call(['hg', 'clone', 'https://hg.adblockplus.org/jsdoc-toolkit/', toolkit])
 
   command = [os.path.join(toolkit, 'jsrun.js'),
              '-t=' + os.path.join(toolkit, 'templates', 'jsdoc'),
@@ -376,7 +376,7 @@ def generateDocs(baseDir, scriptName, opts, args, type):
              os.path.join(baseDir, 'modules'),
              os.path.join(baseDir, 'components'),
              os.path.join(baseDir, 'lib')]
-  subprocess.Popen(command).communicate()
+  subprocess.check_call(command)
 
 
 def runReleaseAutomation(baseDir, scriptName, opts, args, type):
diff --git a/packager.py b/packager.py
index e00b8e1..7006dfa 100644
--- a/packager.py
+++ b/packager.py
@@ -35,9 +35,9 @@ def readMetadata(baseDir, type):
 
 def getBuildNum(baseDir):
   try:
-    (result, dummy) = subprocess.Popen(['hg', 'id', '-R', baseDir, '-n'], stdout=subprocess.PIPE).communicate()
+    result = subprocess.check_output(['hg', 'id', '-R', baseDir, '-n'])
     return re.sub(r'\D', '', result)
-  except Exception:
+  except:
     return '0'
 
 def getBuildVersion(baseDir, metadata, releaseBuild, buildNum=None):
diff --git a/releaseAutomationGecko.py b/releaseAutomationGecko.py
index c52c63f..00fdbfb 100644
--- a/releaseAutomationGecko.py
+++ b/releaseAutomationGecko.py
@@ -38,8 +38,8 @@ def run(baseDir, version, keyFile, downloadsRepo):
   metadata = packager.readMetadata(baseDir)
 
   # Now commit the change and tag it
-  subprocess.Popen(['hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s' % (extensionName, version)]).communicate()
-  subprocess.Popen(['hg', 'tag', '-R', baseDir, '-f', version]).communicate()
+  subprocess.check_call(['hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s' % (extensionName, version)])
+  subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', version])
 
   # Create a release build
   buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(baseDir, metadata, version, 'xpi'))
@@ -50,7 +50,7 @@ def run(baseDir, version, keyFile, downloadsRepo):
 
   archiveHandle = open(archivePath, 'wb')
   archive = tarfile.open(fileobj=archiveHandle, name=os.path.basename(archivePath), mode='w:gz')
-  (data, dummy) = subprocess.Popen(['hg', 'archive', '-R', baseDir, '-t', 'tar', '-S', '-'], stdout=subprocess.PIPE).communicate()
+  data = subprocess.check_output(['hg', 'archive', '-R', baseDir, '-t', 'tar', '-S', '-'])
   repoArchive = tarfile.open(fileobj=StringIO(data), mode='r:')
   for fileInfo in repoArchive:
     if os.path.basename(fileInfo.name) in ('.hgtags', '.hgignore'):
@@ -63,9 +63,9 @@ def run(baseDir, version, keyFile, downloadsRepo):
   archiveHandle.close()
 
   # Now add the downloads and commit
-  subprocess.Popen(['hg', 'add', '-R', downloadsRepo, buildPath, archivePath]).communicate()
-  subprocess.Popen(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version)]).communicate()
+  subprocess.check_call(['hg', 'add', '-R', downloadsRepo, buildPath, archivePath])
+  subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version)])
 
   # Push all changes
-  subprocess.Popen(['hg', 'push', '-R', baseDir]).communicate()
-  subprocess.Popen(['hg', 'push', '-R', downloadsRepo]).communicate()
+  subprocess.check_call(['hg', 'push', '-R', baseDir])
+  subprocess.check_call(['hg', 'push', '-R', downloadsRepo])

-- 
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