From: David-Sarah Hopwood Date: Fri, 15 Mar 2013 04:41:53 +0000 (+0000) Subject: Make doubly sure that we fail quickly on future Python 3.x versions. refs #1775 X-Git-Tag: allmydata-tahoe-1.10a1~14 X-Git-Url: https://git.rkrishnan.org/vdrive/sub?a=commitdiff_plain;h=3bdd744b8e39b657b8de468b2163eec84d87a134;p=tahoe-lafs%2Ftahoe-lafs.git Make doubly sure that we fail quickly on future Python 3.x versions. refs #1775 Signed-off-by: David-Sarah Hopwood --- diff --git a/bin/tahoe-script.template b/bin/tahoe-script.template index abcdaa01..e5a04e10 100644 --- a/bin/tahoe-script.template +++ b/bin/tahoe-script.template @@ -1,7 +1,7 @@ #!/bin/false # You must specify a python interpreter. -ur"Tahoe-LAFS does not run under Python 3. Please use a version of Python between 2.5 and 2.7.x inclusive." +import sys; assert sys.version_info < (3,), ur"Tahoe-LAFS does not run under Python 3. Please use a version of Python between 2.5 and 2.7.x inclusive." -import sys, os, subprocess +import os, subprocess where = os.path.realpath(sys.argv[0]) base = os.path.dirname(os.path.dirname(where)) @@ -63,7 +63,7 @@ if sys.platform == "win32": # Note that this doesn't escape \x7F. If it did, test_unicode_arguments_and_output # in test_runner.py wouldn't work. def mangle(s): - return str(re.sub(ur'[^\x20-\x7F]', lambda m: u'\x7F%x;' % (ord(m.group(0)),), s)) + return str(re.sub(u'[^\\x20-\\x7F]', lambda m: u'\x7F%x;' % (ord(m.group(0)),), s)) argv = [mangle(argv_unicode[i]) for i in xrange(0, argc.value)] diff --git a/setup.py b/setup.py index 6276151b..46db1921 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ #! /usr/bin/env python # -*- coding: utf-8 -*- -ur"Tahoe-LAFS does not run under Python 3. Please use a version of Python between 2.5 and 2.7.x inclusive." +import sys; assert sys.version_info < (3,), ur"Tahoe-LAFS does not run under Python 3. Please use a version of Python between 2.5 and 2.7.x inclusive." # Tahoe-LAFS -- secure, distributed storage grid # @@ -10,7 +10,7 @@ ur"Tahoe-LAFS does not run under Python 3. Please use a version of Python betwee # # See the docs/about.rst file for licensing information. -import glob, os, stat, subprocess, sys, re +import glob, os, stat, subprocess, re ##### sys.path management