Bug 537571, client.py should error out early if wrong python version
authorJustin Wood <Callek@gmail.com>
Wed, 13 Jan 2010 15:53:10 -0500
changeset 4695 2236baab44567cbd88a40483c10090025798ac5c
parent 4694 a589c9a9e41de26987a2a0433175361d2d9716a4
child 4696 6f150db7f8e59ad369906c01d56a5a69fa42eaa7
push idunknown
push userunknown
push dateunknown
bugs537571
Bug 537571, client.py should error out early if wrong python version r+=gozer
client.py
--- a/client.py
+++ b/client.py
@@ -41,19 +41,26 @@ SWITCH_MOZILLA_REPO_BACKUP_LOCATION = ".
 # This is the potential location for a repository from the last time we
 # switched. Can be blank for no effect.
 SWITCH_MOZILLA_REPO_OLD_REPO_LOCATION = ".mozilla-trunk"
 # This should be the same as DEFAULT_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
+# Test Python Version. 2.4 required for `import subprocess`
+pyver = sys.version_info
+if 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.4")
+del pyver
 
 import os
-import sys
 import datetime
 from optparse import OptionParser
 
 topsrcdir = os.path.dirname(__file__)
 if topsrcdir == '':
     topsrcdir = '.'
 
 TREE_STATE_FILE = os.path.join(topsrcdir, '.treestate')