Backed out changeset 25e697e42d9a/Bug 599743
authorJustin Wood <Callek@gmail.com>
Fri, 01 Oct 2010 22:18:19 -0400
changeset 6468 55311f5d4576d28b364da2b1d6a20a47ca77131b
parent 6431 25e697e42d9a9a47f537b19ea0f68785aa68e3fd
child 6469 fe00d3436cdeb8c1868a69411490568b0ed615f3
push idunknown
push userunknown
push dateunknown
bugs599743, 601207
backs out25e697e42d9a9a47f537b19ea0f68785aa68e3fd
Backed out changeset 25e697e42d9a/Bug 599743 Due to Bug 601207.
client.py
--- a/client.py
+++ b/client.py
@@ -51,35 +51,46 @@ SWITCH_MOZILLA_REPO_BACKUP_LOCATION = ".
 # switched. Can be blank for no effect.
 SWITCH_MOZILLA_REPO_OLD_REPO_LOCATION = ".mozilla-trunk"
 # This should be the same as DEFAULTS['MOZILLA_REPO'] but using %s instead of http
 # for the scheme.
 SWITCH_MOZILLA_REPO_REPLACE = '%s://hg.mozilla.org/mozilla-central/'
 SWITCH_MOZILLA_BASE_REV = "GECKO_1_9_1_BASE"
 
 import sys
-# Check Python version: 2.5+ is required for `from subprocess import check_call`.
+# Test Python Version. 2.4 required for `import subprocess`
 pyver = sys.version_info
-if pyver[0] <= 1 or (pyver[0] == 2 and pyver[1] < 5):
-  sys.exit("ERROR: Python 2.5 or newer required")
+if pyver[0] <= 1 or (pyver[0] == 2 and pyver[1] < 4):
+  sys.exit("ERROR: Python 2.4 or newer required")
 elif pyver[0] >= 3:
-  sys.exit("ERROR: Python series 3 is not supported, use series 2 >= 2.5")
+  sys.exit("ERROR: Python series 3 is not supported, use series 2 > 2.4")
 del pyver
 
 import os
 import datetime
 from optparse import OptionParser, OptionValueError
-from subprocess import check_call
 
 topsrcdir = os.path.dirname(__file__)
 if topsrcdir == '':
     topsrcdir = '.'
 
 TREE_STATE_FILE = os.path.join(topsrcdir, '.treestate')
 
+try:
+    from subprocess import check_call
+except ImportError:
+    import subprocess
+    def check_call(*popenargs, **kwargs):
+        retcode = subprocess.call(*popenargs, **kwargs)
+        if retcode:
+            cmd = kwargs.get("args")
+            if cmd is None:
+                cmd = popenargs[0]
+                raise Exception("Command '%s' returned non-zero exit status %i" % (cmd, retcode))
+
 def check_call_noisy(cmd, retryMax=0, *args, **kwargs):
   """Wrapper around execute_check_call() to allow retries before failing.
 
   |cmd|, is the command to try and execute.
   |retryMax|, is the maximum number of retries to attempt, 0 by default.
   """
 
   def execute_check_call(cmd, *args, **kwargs):