summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2017-04-25 22:01:58 +0200
committerArmin Rigo <arigo@tunes.org>2017-04-25 22:01:58 +0200
commitd4222c205a6b59374252c0ad92b9eede1b38e2e9 (patch)
tree52991eed90cf436d0f0c15835005b7ea3410453d
parent2d77c72582447cff2b0eed26c0c660ba378dd285 (diff)
parentd94fa7792b6baf8f5021f1ecae4a158fb171c3de (diff)
downloadcffi-d4222c205a6b59374252c0ad92b9eede1b38e2e9.tar.gz
hg merge find-vcvars
Windows fix, for distutils/setuptools, thanks matti
-rw-r--r--cffi/ffiplatform.py12
-rw-r--r--cffi/verifier.py12
2 files changed, 13 insertions, 11 deletions
diff --git a/cffi/ffiplatform.py b/cffi/ffiplatform.py
index 27cdde0..8531346 100644
--- a/cffi/ffiplatform.py
+++ b/cffi/ffiplatform.py
@@ -6,6 +6,7 @@ LIST_OF_FILE_NAMES = ['sources', 'include_dirs', 'library_dirs',
'extra_objects', 'depends']
def get_extension(srcfilename, modname, sources=(), **kwds):
+ _hack_at_distutils()
from distutils.core import Extension
allsources = [srcfilename]
for src in sources:
@@ -15,6 +16,7 @@ def get_extension(srcfilename, modname, sources=(), **kwds):
def compile(tmpdir, ext, compiler_verbose=0, debug=None):
"""Compile a C extension module using distutils."""
+ _hack_at_distutils()
saved_environ = os.environ.copy()
try:
outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
@@ -113,3 +115,13 @@ def flatten(x):
f = cStringIO.StringIO()
_flatten(x, f)
return f.getvalue()
+
+def _hack_at_distutils():
+ # Windows-only workaround for some configurations: see
+ # https://bugs.python.org/issue23246 (Python 2.7 with
+ # a specific MS compiler suite download)
+ if sys.platform == "win32":
+ try:
+ import setuptools # for side-effects, patches distutils
+ except ImportError:
+ pass
diff --git a/cffi/verifier.py b/cffi/verifier.py
index 22eb6dc..3cfeecb 100644
--- a/cffi/verifier.py
+++ b/cffi/verifier.py
@@ -26,16 +26,6 @@ else:
s = s.encode('ascii')
super(NativeIO, self).write(s)
-def _hack_at_distutils():
- # Windows-only workaround for some configurations: see
- # https://bugs.python.org/issue23246 (Python 2.7 with
- # a specific MS compiler suite download)
- if sys.platform == "win32":
- try:
- import setuptools # for side-effects, patches distutils
- except ImportError:
- pass
-
class Verifier(object):
@@ -126,7 +116,7 @@ class Verifier(object):
return basename
def get_extension(self):
- _hack_at_distutils() # backward compatibility hack
+ ffiplatform._hack_at_distutils() # backward compatibility hack
if not self._has_source:
with self.ffi._lock:
if not self._has_source: