summaryrefslogtreecommitdiff
path: root/numpy/distutils/extension.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-04-13 09:05:31 -0600
committerCharles Harris <charlesr.harris@gmail.com>2013-04-13 09:05:31 -0600
commit68338eed3ae91c9846142e088c16b63635e58178 (patch)
treeadaec2f35174f838edbc932921eccac10c7c3886 /numpy/distutils/extension.py
parent688bc60658b391524c6b641e0a5e5ecd73322d02 (diff)
downloadnumpy-68338eed3ae91c9846142e088c16b63635e58178.tar.gz
2to3: Apply basestring fixer.
The basestring class is not defined in Python 3 and the fixer replaces it with str. In order to have a common code base we define basestring in numpy/compat/py3k.py to be str when the Python version is >= 3, otherwise basestring and import it where needed. That works for most cases, but there are a few files where the version dependent define needs to be in the file. Closes #3042.
Diffstat (limited to 'numpy/distutils/extension.py')
-rw-r--r--numpy/distutils/extension.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/numpy/distutils/extension.py b/numpy/distutils/extension.py
index b30adb397..7fc6e1ae7 100644
--- a/numpy/distutils/extension.py
+++ b/numpy/distutils/extension.py
@@ -8,11 +8,14 @@ Overridden to support f2py.
"""
from __future__ import division, absolute_import, print_function
-__revision__ = "$Id: extension.py,v 1.1 2005/04/09 19:29:34 pearu Exp $"
-
+import sys
+import re
from distutils.extension import Extension as old_Extension
-import re
+if sys.version_info[0] >= 3:
+ basestring = str
+
+
cxx_ext_re = re.compile(r'.*[.](cpp|cxx|cc)\Z',re.I).match
fortran_pyf_ext_re = re.compile(r'.*[.](f90|f95|f77|for|ftn|f|pyf)\Z',re.I).match