summaryrefslogtreecommitdiff
path: root/numpy/distutils
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2016-12-13 15:53:56 -0700
committerCharles Harris <charlesr.harris@gmail.com>2016-12-14 11:33:22 -0700
commitec0e04694278ef9ea83537d308b07fc27c1b5f85 (patch)
treea28bb53d6827e5449c3f2d5ade3a4ad43bef7ca0 /numpy/distutils
parent2a1e5a6d2ffdabf2a18875ee8dd57773d608e4c5 (diff)
downloadnumpy-ec0e04694278ef9ea83537d308b07fc27c1b5f85.tar.gz
DEP: Fix escaped string characters deprecated in Python 3.6.
In Python 3.6 a number of escape sequences that were previously accepted -- for instance "\(" that was translated to "\\(" -- are deprecated. To retain the previous behavior either raw strings must be used or the backslash must be properly escaped itself.
Diffstat (limited to 'numpy/distutils')
-rw-r--r--numpy/distutils/command/build_src.py11
-rw-r--r--numpy/distutils/cpuinfo.py6
-rw-r--r--numpy/distutils/fcompiler/compaq.py4
-rw-r--r--numpy/distutils/fcompiler/gnu.py2
-rw-r--r--numpy/distutils/fcompiler/ibm.py2
-rw-r--r--numpy/distutils/fcompiler/intel.py2
-rw-r--r--numpy/distutils/fcompiler/vast.py4
-rw-r--r--numpy/distutils/from_template.py8
-rw-r--r--numpy/distutils/intelccompiler.py4
-rw-r--r--numpy/distutils/mingw32ccompiler.py2
-rw-r--r--numpy/distutils/misc_util.py2
-rw-r--r--numpy/distutils/npy_pkg_config.py4
12 files changed, 26 insertions, 25 deletions
diff --git a/numpy/distutils/command/build_src.py b/numpy/distutils/command/build_src.py
index edb37b8ed..18db1bb42 100644
--- a/numpy/distutils/command/build_src.py
+++ b/numpy/distutils/command/build_src.py
@@ -18,8 +18,9 @@ from distutils.errors import DistutilsError, DistutilsSetupError
# after it's installed
#import numpy.f2py
from numpy.distutils import log
-from numpy.distutils.misc_util import fortran_ext_match, \
- appendpath, is_string, is_sequence, get_cmd
+from numpy.distutils.misc_util import (
+ fortran_ext_match, appendpath, is_string, is_sequence, get_cmd
+ )
from numpy.distutils.from_template import process_file as process_f_file
from numpy.distutils.conv_template import process_file as process_c_file
@@ -755,9 +756,9 @@ def _find_swig_target(target_dir, name):
#### F2PY related auxiliary functions ####
_f2py_module_name_match = re.compile(r'\s*python\s*module\s*(?P<name>[\w_]+)',
- re.I).match
-_f2py_user_module_name_match = re.compile(r'\s*python\s*module\s*(?P<name>[\w_]*?'\
- '__user__[\w_]*)', re.I).match
+ re.I).match
+_f2py_user_module_name_match = re.compile(r'\s*python\s*module\s*(?P<name>[\w_]*?'
+ r'__user__[\w_]*)', re.I).match
def get_f2py_modulename(source):
name = None
diff --git a/numpy/distutils/cpuinfo.py b/numpy/distutils/cpuinfo.py
index dba5a3298..652826376 100644
--- a/numpy/distutils/cpuinfo.py
+++ b/numpy/distutils/cpuinfo.py
@@ -93,7 +93,7 @@ class CPUInfoBase(object):
def __get_nbits(self):
abits = platform.architecture()[0]
- nbits = re.compile('(\d+)bit').search(abits).group(1)
+ nbits = re.compile(r'(\d+)bit').search(abits).group(1)
return nbits
def _is_32bit(self):
@@ -495,8 +495,8 @@ class Win32CPUInfo(CPUInfoBase):
else:
import _winreg as winreg
- prgx = re.compile(r"family\s+(?P<FML>\d+)\s+model\s+(?P<MDL>\d+)"\
- "\s+stepping\s+(?P<STP>\d+)", re.IGNORECASE)
+ prgx = re.compile(r"family\s+(?P<FML>\d+)\s+model\s+(?P<MDL>\d+)"
+ r"\s+stepping\s+(?P<STP>\d+)", re.IGNORECASE)
chnd=winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, self.pkey)
pnum=0
while True:
diff --git a/numpy/distutils/fcompiler/compaq.py b/numpy/distutils/fcompiler/compaq.py
index 2dd6c01e6..1510ca9d8 100644
--- a/numpy/distutils/fcompiler/compaq.py
+++ b/numpy/distutils/fcompiler/compaq.py
@@ -58,8 +58,8 @@ class CompaqVisualFCompiler(FCompiler):
compiler_type = 'compaqv'
description = 'DIGITAL or Compaq Visual Fortran Compiler'
- version_pattern = r'(DIGITAL|Compaq) Visual Fortran Optimizing Compiler'\
- ' Version (?P<version>[^\s]*).*'
+ version_pattern = (r'(DIGITAL|Compaq) Visual Fortran Optimizing Compiler'
+ r' Version (?P<version>[^\s]*).*')
compile_switch = '/compile_only'
object_switch = '/object:'
diff --git a/numpy/distutils/fcompiler/gnu.py b/numpy/distutils/fcompiler/gnu.py
index 1cddf7e83..4649fd743 100644
--- a/numpy/distutils/fcompiler/gnu.py
+++ b/numpy/distutils/fcompiler/gnu.py
@@ -15,7 +15,7 @@ from numpy.distutils.compat import get_exception
compilers = ['GnuFCompiler', 'Gnu95FCompiler']
-TARGET_R = re.compile("Target: ([a-zA-Z0-9_\-]*)")
+TARGET_R = re.compile(r"Target: ([a-zA-Z0-9_\-]*)")
# XXX: handle cross compilation
def is_win64():
diff --git a/numpy/distutils/fcompiler/ibm.py b/numpy/distutils/fcompiler/ibm.py
index cc65df972..388ec99b1 100644
--- a/numpy/distutils/fcompiler/ibm.py
+++ b/numpy/distutils/fcompiler/ibm.py
@@ -36,7 +36,7 @@ class IBMFCompiler(FCompiler):
xlf = find_executable('xlf')
if os.path.exists(xlf) and os.path.exists(lslpp):
s, o = exec_command(lslpp + ' -Lc xlfcmp')
- m = re.search('xlfcmp:(?P<version>\d+([.]\d+)+)', o)
+ m = re.search(r'xlfcmp:(?P<version>\d+([.]\d+)+)', o)
if m: version = m.group('version')
xlf_dir = '/etc/opt/ibmcmp/xlf'
diff --git a/numpy/distutils/fcompiler/intel.py b/numpy/distutils/fcompiler/intel.py
index f3e616e1d..f6f2d7e32 100644
--- a/numpy/distutils/fcompiler/intel.py
+++ b/numpy/distutils/fcompiler/intel.py
@@ -202,7 +202,7 @@ class IntelEM64VisualFCompiler(IntelVisualFCompiler):
compiler_type = 'intelvem'
description = 'Intel Visual Fortran Compiler for 64-bit apps'
- version_match = simple_version_match(start='Intel\(R\).*?64,')
+ version_match = simple_version_match(start=r'Intel\(R\).*?64,')
def get_flags_arch(self):
return ['']
diff --git a/numpy/distutils/fcompiler/vast.py b/numpy/distutils/fcompiler/vast.py
index 05bbc10ba..df3469dff 100644
--- a/numpy/distutils/fcompiler/vast.py
+++ b/numpy/distutils/fcompiler/vast.py
@@ -10,8 +10,8 @@ class VastFCompiler(GnuFCompiler):
compiler_type = 'vast'
compiler_aliases = ()
description = 'Pacific-Sierra Research Fortran 90 Compiler'
- version_pattern = r'\s*Pacific-Sierra Research vf90 '\
- '(Personal|Professional)\s+(?P<version>[^\s]*)'
+ version_pattern = (r'\s*Pacific-Sierra Research vf90 '
+ r'(Personal|Professional)\s+(?P<version>[^\s]*)')
# VAST f90 does not support -o with -c. So, object files are created
# to the current directory and then moved to build directory
diff --git a/numpy/distutils/from_template.py b/numpy/distutils/from_template.py
index e38e4d608..ff2130297 100644
--- a/numpy/distutils/from_template.py
+++ b/numpy/distutils/from_template.py
@@ -93,7 +93,7 @@ def find_repl_patterns(astr):
names = {}
for rep in reps:
name = rep[0].strip() or unique_key(names)
- repl = rep[1].replace('\,', '@comma@')
+ repl = rep[1].replace(r'\,', '@comma@')
thelist = conv(repl)
names[name] = thelist
return names
@@ -125,13 +125,13 @@ def unique_key(adict):
template_name_re = re.compile(r'\A\s*(\w[\w\d]*)\s*\Z')
def expand_sub(substr, names):
- substr = substr.replace('\>', '@rightarrow@')
- substr = substr.replace('\<', '@leftarrow@')
+ substr = substr.replace(r'\>', '@rightarrow@')
+ substr = substr.replace(r'\<', '@leftarrow@')
lnames = find_repl_patterns(substr)
substr = named_re.sub(r"<\1>", substr) # get rid of definition templates
def listrepl(mobj):
- thelist = conv(mobj.group(1).replace('\,', '@comma@'))
+ thelist = conv(mobj.group(1).replace(r'\,', '@comma@'))
if template_name_re.match(thelist):
return "<%s>" % (thelist)
name = None
diff --git a/numpy/distutils/intelccompiler.py b/numpy/distutils/intelccompiler.py
index ee089dbae..902f19b67 100644
--- a/numpy/distutils/intelccompiler.py
+++ b/numpy/distutils/intelccompiler.py
@@ -79,7 +79,7 @@ if platform.system() == 'Windows':
def __init__(self, verbose=0, dry_run=0, force=0):
MSVCCompiler.__init__(self, verbose, dry_run, force)
- version_match = simple_version_match(start='Intel\(R\).*?32,')
+ version_match = simple_version_match(start=r'Intel\(R\).*?32,')
self.__version = version_match
def initialize(self, plat_name=None):
@@ -101,5 +101,5 @@ if platform.system() == 'Windows':
def __init__(self, verbose=0, dry_run=0, force=0):
MSVCCompiler.__init__(self, verbose, dry_run, force)
- version_match = simple_version_match(start='Intel\(R\).*?64,')
+ version_match = simple_version_match(start=r'Intel\(R\).*?64,')
self.__version = version_match
diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py
index 3a75a70e8..0a0d651ad 100644
--- a/numpy/distutils/mingw32ccompiler.py
+++ b/numpy/distutils/mingw32ccompiler.py
@@ -76,7 +76,7 @@ class Mingw32CCompiler(distutils.cygwinccompiler.CygwinCCompiler):
stdout=subprocess.PIPE)
out_string = p.stdout.read()
p.stdout.close()
- result = re.search('(\d+\.\d+)', out_string)
+ result = re.search(r'(\d+\.\d+)', out_string)
if result:
self.gcc_version = StrictVersion(result.group(1))
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
index b4b0aaf29..de0e4a47a 100644
--- a/numpy/distutils/misc_util.py
+++ b/numpy/distutils/misc_util.py
@@ -1901,7 +1901,7 @@ class Configuration(object):
-----
This method scans files named
__version__.py, <packagename>_version.py, version.py, and
- __svn_version__.py for string variables version, __version\__, and
+ __svn_version__.py for string variables version, __version__, and
<packagename>_version, until a version number is found.
"""
version = getattr(self, 'version', None)
diff --git a/numpy/distutils/npy_pkg_config.py b/numpy/distutils/npy_pkg_config.py
index e7d6448ea..6fe517659 100644
--- a/numpy/distutils/npy_pkg_config.py
+++ b/numpy/distutils/npy_pkg_config.py
@@ -12,7 +12,7 @@ else:
__all__ = ['FormatError', 'PkgNotFound', 'LibraryInfo', 'VariableSet',
'read_config', 'parse_flags']
-_VAR = re.compile('\$\{([a-zA-Z0-9_-]+)\}')
+_VAR = re.compile(r'\$\{([a-zA-Z0-9_-]+)\}')
class FormatError(IOError):
"""
@@ -427,7 +427,7 @@ if __name__ == '__main__':
section = "default"
if options.define_variable:
- m = re.search('([\S]+)=([\S]+)', options.define_variable)
+ m = re.search(r'([\S]+)=([\S]+)', options.define_variable)
if not m:
raise ValueError("--define-variable option should be of " \
"the form --define-variable=foo=bar")