1 From c14554c7e2fff8dd559dfb41e7dd11392c6f85e3 Mon Sep 17 00:00:00 2001
2 From: Alexander Kanavin <alex.kanavin@gmail.com>
3 Date: Thu, 10 Dec 2015 13:20:30 +0200
4 Subject: [PATCH] Don't search /usr and so on for libraries by default to
6 avoid host contamination.
8 Upstream-Status: Inappropriate (As the code stands, this is a hack)
9 Signed-off-by: Ross Burton <ross.burton@intel.com>
10 Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
13 numpy/distutils/system_info.py | 50 ++++------------------------------
14 1 file changed, 6 insertions(+), 44 deletions(-)
16 diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
17 index 2424943..bf56a6d 100644
18 --- a/numpy/distutils/system_info.py
19 +++ b/numpy/distutils/system_info.py
20 @@ -274,51 +274,13 @@ if sys.platform == 'win32':
21 add_system_root(os.path.join(conda_dir, 'Library'))
24 - default_lib_dirs = libpaths(['/usr/local/lib', '/opt/lib', '/usr/lib',
25 - '/opt/local/lib', '/sw/lib'], platform_bits)
26 default_runtime_dirs = []
27 - default_include_dirs = ['/usr/local/include',
28 - '/opt/include', '/usr/include',
29 - # path of umfpack under macports
30 - '/opt/local/include/ufsparse',
31 - '/opt/local/include', '/sw/include',
32 - '/usr/include/suitesparse']
33 - default_src_dirs = ['.', '/usr/local/src', '/opt/src', '/sw/src']
35 - default_x11_lib_dirs = libpaths(['/usr/X11R6/lib', '/usr/X11/lib',
36 - '/usr/lib'], platform_bits)
37 - default_x11_include_dirs = ['/usr/X11R6/include', '/usr/X11/include',
40 - if os.path.exists('/usr/lib/X11'):
41 - globbed_x11_dir = glob('/usr/lib/*/libX11.so')
43 - x11_so_dir = os.path.split(globbed_x11_dir[0])[0]
44 - default_x11_lib_dirs.extend([x11_so_dir, '/usr/lib/X11'])
45 - default_x11_include_dirs.extend(['/usr/lib/X11/include',
46 - '/usr/include/X11'])
48 - import subprocess as sp
51 - # Explicitly open/close file to avoid ResourceWarning when
52 - # tests are run in debug mode Python 3.
53 - tmp = open(os.devnull, 'w')
54 - p = sp.Popen(["gcc", "-print-multiarch"], stdout=sp.PIPE,
56 - except (OSError, DistutilsError):
57 - # OSError if gcc is not installed, or SandboxViolation (DistutilsError
58 - # subclass) if an old setuptools bug is triggered (see gh-3160).
61 - triplet = str(p.communicate()[0].decode().strip())
62 - if p.returncode == 0:
63 - # gcc supports the "-print-multiarch" option
64 - default_x11_lib_dirs += [os.path.join("/usr/lib/", triplet)]
65 - default_lib_dirs += [os.path.join("/usr/lib/", triplet)]
69 + default_lib_dirs = libpaths(['/deadir/lib'], platform_bits)
70 + default_include_dirs = ['/deaddir/include']
71 + default_src_dirs = ['.', '/deaddir/src']
73 + default_x11_lib_dirs = libpaths(['/deaddir/lib'], platform_bits)
74 + default_x11_include_dirs = ['/deaddir/include']
76 if os.path.join(sys.prefix, 'lib') not in default_lib_dirs:
77 default_lib_dirs.insert(0, os.path.join(sys.prefix, 'lib'))