提交 f120de51 authored 作者: abergeron's avatar abergeron

Merge pull request #2518 from nouiz/canopy_win

Canopy win
...@@ -1425,6 +1425,10 @@ def std_include_dirs(): ...@@ -1425,6 +1425,10 @@ def std_include_dirs():
def std_lib_dirs_and_libs(): def std_lib_dirs_and_libs():
# We cache the results as on Windows, this trigger file access and
# this method is called many times.
if std_lib_dirs_and_libs.data is not None:
return std_lib_dirs_and_libs.data
python_inc = distutils.sysconfig.get_python_inc() python_inc = distutils.sysconfig.get_python_inc()
if sys.platform == 'win32': if sys.platform == 'win32':
# Obtain the library name from the Python version instead of the # Obtain the library name from the Python version instead of the
...@@ -1452,25 +1456,39 @@ def std_lib_dirs_and_libs(): ...@@ -1452,25 +1456,39 @@ def std_lib_dirs_and_libs():
#sys.base_prefix support only one case #sys.base_prefix support only one case
libdir = os.path.join(sys.prefix, 'libs') libdir = os.path.join(sys.prefix, 'libs')
for f, lib in [('libpython27.a', 'libpython 1.2'), for f, lib in [('libpython27.a', 'libpython 1.2')]:
('libmsvcr90.a', 'mingw 4.5.2')]:
if not os.path.exists(os.path.join(libdir, f)): if not os.path.exists(os.path.join(libdir, f)):
print ("Your Python version is from Canopy. " + print ("Your Python version is from Canopy. " +
"You need to install the package '" + lib + "You need to install the package '" + lib +
"' from Canopy package manager." "' from Canopy package manager."
) )
libdirs = [
# Used in older Canopy
os.path.join(sys.prefix, 'libs'),
# Used in newer Canopy
os.path.join(sys.prefix,
'EGG-INFO\mingw\usr\x86_64-w64-mingw32\lib')]
for f, lib in [('libmsvcr90.a',
'mingw 4.5.2 or 4.8.1-2 (newer could work)')]:
if not any([os.path.exists(os.path.join(libdir, f))
for libdir in libdirs]):
print ("Your Python version is from Canopy. " +
"You need to install the package '" + lib +
"' from Canopy package manager."
)
python_lib_dirs.insert(0, libdir) python_lib_dirs.insert(0, libdir)
std_lib_dirs_and_libs.data = [libname], python_lib_dirs
return [libname], python_lib_dirs
# Suppress -lpython2.x on OS X since the `-undefined dynamic_lookup` # Suppress -lpython2.x on OS X since the `-undefined dynamic_lookup`
# makes it unnecessary. # makes it unnecessary.
elif sys.platform == 'darwin': elif sys.platform == 'darwin':
return [], [] std_lib_dirs_and_libs.data = [], []
else: else:
# Typical include directory: /usr/include/python2.6 # Typical include directory: /usr/include/python2.6
libname = os.path.basename(python_inc) libname = os.path.basename(python_inc)
return [libname], [] std_lib_dirs_and_libs.data = [libname], []
return std_lib_dirs_and_libs.data
std_lib_dirs_and_libs.data = None
def std_libs(): def std_libs():
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论