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