aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2008-08-19 17:56:33 +0000
committerAntoine Pitrou <solipsis@pitrou.net>2008-08-19 17:56:33 +0000
commit9b46d3fc54dc19f29a4d7503e8c06dcfbebd7b5a (patch)
tree6affd607f6832e640abf3c3217ce2a4e629ec9ad
parentdd8e87105079fbf52d866825dc56482a40732b99 (diff)
downloadexternal_python_setuptools-9b46d3fc54dc19f29a4d7503e8c06dcfbebd7b5a.tar.gz
external_python_setuptools-9b46d3fc54dc19f29a4d7503e8c06dcfbebd7b5a.tar.bz2
external_python_setuptools-9b46d3fc54dc19f29a4d7503e8c06dcfbebd7b5a.zip
#2834: Change re module semantics, so that str and bytes mixing is forbidden,
and str (unicode) patterns get full unicode matching by default. The re.ASCII flag is also introduced to ask for ASCII matching instead.
-rw-r--r--cygwinccompiler.py6
-rw-r--r--emxccompiler.py2
-rw-r--r--sysconfig.py2
-rw-r--r--util.py2
-rw-r--r--version.py2
-rw-r--r--versionpredicate.py6
6 files changed, 11 insertions, 9 deletions
diff --git a/cygwinccompiler.py b/cygwinccompiler.py
index 48875230..da2c74a2 100644
--- a/cygwinccompiler.py
+++ b/cygwinccompiler.py
@@ -409,7 +409,7 @@ def get_versions():
out = os.popen(gcc_exe + ' -dumpversion','r')
out_string = out.read()
out.close()
- result = re.search('(\d+\.\d+(\.\d+)*)',out_string)
+ result = re.search('(\d+\.\d+(\.\d+)*)', out_string, re.ASCII)
if result:
gcc_version = StrictVersion(result.group(1))
else:
@@ -421,7 +421,7 @@ def get_versions():
out = os.popen(ld_exe + ' -v','r')
out_string = out.read()
out.close()
- result = re.search('(\d+\.\d+(\.\d+)*)',out_string)
+ result = re.search('(\d+\.\d+(\.\d+)*)', out_string, re.ASCII)
if result:
ld_version = StrictVersion(result.group(1))
else:
@@ -433,7 +433,7 @@ def get_versions():
out = os.popen(dllwrap_exe + ' --version','r')
out_string = out.read()
out.close()
- result = re.search(' (\d+\.\d+(\.\d+)*)',out_string)
+ result = re.search(' (\d+\.\d+(\.\d+)*)', out_string, re.ASCII)
if result:
dllwrap_version = StrictVersion(result.group(1))
else:
diff --git a/emxccompiler.py b/emxccompiler.py
index d9ee82d5..62a4c5b4 100644
--- a/emxccompiler.py
+++ b/emxccompiler.py
@@ -300,7 +300,7 @@ def get_versions():
out = os.popen(gcc_exe + ' -dumpversion','r')
out_string = out.read()
out.close()
- result = re.search('(\d+\.\d+\.\d+)',out_string)
+ result = re.search('(\d+\.\d+\.\d+)', out_string, re.ASCII)
if result:
gcc_version = StrictVersion(result.group(1))
else:
diff --git a/sysconfig.py b/sysconfig.py
index 3a120dd5..b17743a8 100644
--- a/sysconfig.py
+++ b/sysconfig.py
@@ -512,7 +512,7 @@ def get_config_vars(*args):
# patched up as well.
'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
flags = _config_vars[key]
- flags = re.sub('-arch\s+\w+\s', ' ', flags)
+ flags = re.sub('-arch\s+\w+\s', ' ', flags, re.ASCII)
flags = re.sub('-isysroot [^ \t]*', ' ', flags)
_config_vars[key] = flags
diff --git a/util.py b/util.py
index 76798b95..b87dfbe0 100644
--- a/util.py
+++ b/util.py
@@ -81,7 +81,7 @@ def get_platform ():
return "%s-%s.%s" % (osname, version, release)
elif osname[:6] == "cygwin":
osname = "cygwin"
- rel_re = re.compile (r'[\d.]+')
+ rel_re = re.compile (r'[\d.]+', re.ASCII)
m = rel_re.match(release)
if m:
release = m.group()
diff --git a/version.py b/version.py
index f71b2f6c..907f71c3 100644
--- a/version.py
+++ b/version.py
@@ -134,7 +134,7 @@ class StrictVersion (Version):
"""
version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$',
- re.VERBOSE)
+ re.VERBOSE | re.ASCII)
def parse (self, vstring):
diff --git a/versionpredicate.py b/versionpredicate.py
index 434b34f1..b0dd9f45 100644
--- a/versionpredicate.py
+++ b/versionpredicate.py
@@ -5,7 +5,8 @@ import distutils.version
import operator
-re_validPackage = re.compile(r"(?i)^\s*([a-z_]\w*(?:\.[a-z_]\w*)*)(.*)")
+re_validPackage = re.compile(r"(?i)^\s*([a-z_]\w*(?:\.[a-z_]\w*)*)(.*)",
+ re.ASCII)
# (package) (rest)
re_paren = re.compile(r"^\s*\((.*)\)\s*$") # (list) inside of parentheses
@@ -153,7 +154,8 @@ def split_provision(value):
global _provision_rx
if _provision_rx is None:
_provision_rx = re.compile(
- "([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)(?:\s*\(\s*([^)\s]+)\s*\))?$")
+ "([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)(?:\s*\(\s*([^)\s]+)\s*\))?$",
+ re.ASCII)
value = value.strip()
m = _provision_rx.match(value)
if not m: