Bug 1257095 - Bootstrapper now checks if Python interpreter is version 2.6 or 2.7 so users get a readable error instead of a stack trace. r?gps
Should be a stopgap until bootstrapper is ported to Python 3.
MozReview-Commit-ID: 2NNC3jMftr9
--- a/python/mozboot/bin/bootstrap.py
+++ b/python/mozboot/bin/bootstrap.py
@@ -7,22 +7,33 @@
# the tree.
#
# The role of this script is to load the Python modules containing actual
# bootstrap support. It does this through various means, including fetching
# content from the upstream source repository.
# If we add unicode_literals, optparse breaks on Python 2.6.1 (which is needed
# to support OS X 10.6).
+
from __future__ import print_function
+WRONG_PYTHON_VERSION_MESSAGE = '''
+Bootstrap currently only runs on Python 2.7 or Python 2.6. Please try re-running with python2.7 or python2.6.
+
+If these aren't available on your system, you may need to install them. Look for a "python2" or "python27" package in your package manager.
+'''
+
+import sys
+if sys.version_info[:2] not in [(2, 6), (2, 7)]:
+ print(WRONG_PYTHON_VERSION_MESSAGE)
+ sys.exit(1)
+
import os
import shutil
from StringIO import StringIO
-import sys
import tempfile
try:
from urllib2 import urlopen
except ImportError:
from urllib.request import urlopen
import zipfile
from optparse import OptionParser