提交 e2368a42 authored 作者: Frederic's avatar Frederic

Fix canopy linker to MKL when their is multiple canopy version.

The logic is simpler now, but I kept the old one as a fall back.
上级 2dc31319
...@@ -222,35 +222,38 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in ...@@ -222,35 +222,38 @@ SOMEPATH/Canopy_64bit/User/lib/python2.7/site-packages/numpy/distutils/system_in
['-l%s' % l for l in blas_info['libraries']]) ['-l%s' % l for l in blas_info['libraries']])
#Canopy #Canopy
if "Canopy" in sys.prefix: if "Canopy" in sys.prefix:
if sys.platform == "darwin":
p2 = os.path.join(sys.base_prefix, "lib")
assert os.path.exists(p2), "Canopy changed the location of MKL"
return ' '.join(
['-L%s' % p2] +
['-l%s' % l for l in blas_info['libraries']])
p = os.path.join(sys.base_prefix, "..", "..", "appdata")
assert os.path.exists(p), "Canopy changed the location of MKL"
p2 = os.listdir(p)
subsub = 'lib' subsub = 'lib'
if sys.platform == 'win32': if sys.platform == 'win32':
subsub = 'Scripts' subsub = 'Scripts'
lib_path = os.path.join(sys.base_prefix, subsub)
if not os.path.exists(lib_path):
# Old logic to find the path. I don't think we still
# need it, but I don't have the time to test all
# installation configuration. So I keep this as a fall
# back in case the current expectation don't work.
# This old logic don't work when multiple version of
# Canopy is installed.
p = os.path.join(sys.base_prefix, "..", "..", "appdata")
assert os.path.exists(p), "Canopy changed the location of MKL"
lib_paths = os.listdir(p)
# Try to remove subdir that can't contain MKL # Try to remove subdir that can't contain MKL
for sub in p2: for sub in lib_paths:
if not os.path.exists(os.path.join(p, sub, subsub)): if not os.path.exists(os.path.join(p, sub, subsub)):
p2.remove(sub) lib_paths.remove(sub)
assert len(p2) == 1, ("Canopy changed the location of MKL", assert len(lib_paths) == 1, (
p, p2, [os.listdir(os.path.join(p, sub)) "Unexpected case when looking for Canopy MKL libraries",
for sub in p2]) p, lib_paths, [os.listdir(os.path.join(p, sub))
p2 = os.path.join(p, p2[0], subsub) for sub in lib_paths])
assert os.path.exists(p2), "Canopy changed the location of MKL" lib_path = os.path.join(p, lib_paths[0], subsub)
if sys.platform == "linux2": assert os.path.exists(lib_path), "Canopy changed the location of MKL"
if sys.platform == "linux2" or sys.platform == "darwin":
return ' '.join( return ' '.join(
['-L%s' % p2] + ['-L%s' % lib_path] +
['-l%s' % l for l in blas_info['libraries']]) ['-l%s' % l for l in blas_info['libraries']])
elif sys.platform == 'win32': elif sys.platform == 'win32':
return ' '.join( return ' '.join(
['-L%s' % p2] + ['-L%s' % lib_path] +
# Why on Windows, the library used are not the # Why on Windows, the library used are not the
# same as what is in blas_info['libraries']? # same as what is in blas_info['libraries']?
['-l%s' % l for l in ["mk2_core", "mk2_intel_thread", ['-l%s' % l for l in ["mk2_core", "mk2_intel_thread",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论