diff options
Diffstat (limited to 'cffi')
-rw-r--r-- | cffi/ffiplatform.py | 13 | ||||
-rw-r--r-- | cffi/verifier.py | 12 |
2 files changed, 14 insertions, 11 deletions
diff --git a/cffi/ffiplatform.py b/cffi/ffiplatform.py index 27cdde0..8a4a1d1 100644 --- a/cffi/ffiplatform.py +++ b/cffi/ffiplatform.py @@ -113,3 +113,16 @@ 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 + +# this must be done before get_extension() and before compile() +_hack_at_distutils() 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: |