summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2017-04-25 20:31:15 +0300
committerMatti Picus <matti.picus@gmail.com>2017-04-25 20:31:15 +0300
commitd94fa7792b6baf8f5021f1ecae4a158fb171c3de (patch)
tree52991eed90cf436d0f0c15835005b7ea3410453d
parent255710744f50377af9418dc17e5cc2844542fc5f (diff)
downloadcffi-find-vcvars.tar.gz
move _hack_at_distutils from global to per-functionfind-vcvars
-rw-r--r--cffi/ffiplatform.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/cffi/ffiplatform.py b/cffi/ffiplatform.py
index 8a4a1d1..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)
@@ -123,6 +125,3 @@ def _hack_at_distutils():
import setuptools # for side-effects, patches distutils
except ImportError:
pass
-
-# this must be done before get_extension() and before compile()
-_hack_at_distutils()