diff options
author | Roland Kaufmann <rka081+numpy@uib.no> | 2017-06-22 09:08:13 +0200 |
---|---|---|
committer | Roland Kaufmann <rka081+numpy@uib.no> | 2017-06-22 23:23:41 +0200 |
commit | a2b416f60e6f3f2746bf3edaf8e6161204f528a5 (patch) | |
tree | 46d01fc2c038211c852c5514dfa93f357229183e /numpy | |
parent | 6c9dece14f90d972ca83ae0cfb879c3f74a7bf1f (diff) | |
download | numpy-a2b416f60e6f3f2746bf3edaf8e6161204f528a5.tar.gz |
BUG: Handle MinGW module compilation in Py2.7 venvs
If we are using the virtualenv module in Python 2.7 (as opposed to venv
in Python 3.3+), then the location of the base distribution is stored in
the real_prefix attribute instead of the base_prefix attribute.
This changeset adds the content of this attribute to the search paths if
it exist (i.e. in practice, if we are running Python 2.7), so that the
runtime libraries do not have to be duplicated in the virtualenv
directory.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/distutils/mingw32ccompiler.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py index 8e14fea13..ec672e205 100644 --- a/numpy/distutils/mingw32ccompiler.py +++ b/numpy/distutils/mingw32ccompiler.py @@ -251,11 +251,14 @@ def find_python_dll(): # We can't do much here: # - find it in the virtualenv (sys.prefix) # - find it in python main dir (sys.base_prefix, if in a virtualenv) + # - sys.real_prefix is main dir for virtualenvs in Python 2.7 # - in system32, # - ortherwise (Sxs), I don't know how to get it. stems = [sys.prefix] if hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix: stems.append(sys.base_prefix) + elif hasattr(sys, 'real_prefix') and sys.real_prefix != sys.prefix: + stems.append(sys.real_prefix) sub_dirs = ['', 'lib', 'bin'] # generate possible combinations of directory trees and sub-directories @@ -428,6 +431,8 @@ def _check_for_import_lib(): stems = [sys.prefix] if hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix: stems.append(sys.base_prefix) + elif hasattr(sys, 'real_prefix') and sys.real_prefix != sys.prefix: + stems.append(sys.real_prefix) # possible subdirectories within those trees where it is placed sub_dirs = ['libs', 'lib'] @@ -481,9 +486,12 @@ def _build_import_library_x86(): lib_file = os.path.join(sys.prefix, 'libs', lib_name) if not os.path.isfile(lib_file): # didn't find library file in virtualenv, try base distribution, too, - # and use that instead if found there + # and use that instead if found there. for Python 2.7 venvs, the base + # directory is in attribute real_prefix instead of base_prefix. if hasattr(sys, 'base_prefix'): base_lib = os.path.join(sys.base_prefix, 'libs', lib_name) + elif hasattr(sys, 'real_prefix'): + base_lib = os.path.join(sys.real_prefix, 'libs', lib_name) else: base_lib = '' # os.path.isfile('') == False |