blob: ffd6ced1361ae54a8bcc562da9f2a74716cd3190 [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
Brad Bishopd7bf8c12018-02-25 22:55:05 -050014Index: numpy-1.13.1/numpy/distutils/system_info.py
15===================================================================
16--- numpy-1.13.1.orig/numpy/distutils/system_info.py
17+++ numpy-1.13.1/numpy/distutils/system_info.py
18@@ -211,51 +211,13 @@ if sys.platform == 'win32':
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050019 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']
Brad Bishopd7bf8c12018-02-25 22:55:05 -050032+ default_lib_dirs = libpaths(['/deadir/lib'], platform_bits)
33+ default_include_dirs = ['/deaddir/include']
34+ default_src_dirs = ['.', '/deaddir/src']
35
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050036- default_x11_lib_dirs = libpaths(['/usr/X11R6/lib', '/usr/X11/lib',
37- '/usr/lib'], platform_bits)
38- default_x11_include_dirs = ['/usr/X11R6/include', '/usr/X11/include',
39- '/usr/include']
40-
41- if os.path.exists('/usr/lib/X11'):
42- globbed_x11_dir = glob('/usr/lib/*/libX11.so')
43- if globbed_x11_dir:
44- x11_so_dir = os.path.split(globbed_x11_dir[0])[0]
45- default_x11_lib_dirs.extend([x11_so_dir, '/usr/lib/X11'])
46- default_x11_include_dirs.extend(['/usr/lib/X11/include',
47- '/usr/include/X11'])
48-
49- import subprocess as sp
50- tmp = None
51- try:
52- # Explicitly open/close file to avoid ResourceWarning when
53- # tests are run in debug mode Python 3.
54- tmp = open(os.devnull, 'w')
55- p = sp.Popen(["gcc", "-print-multiarch"], stdout=sp.PIPE,
Brad Bishopd7bf8c12018-02-25 22:55:05 -050056- stderr=tmp)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050057- except (OSError, DistutilsError):
58- # OSError if gcc is not installed, or SandboxViolation (DistutilsError
59- # subclass) if an old setuptools bug is triggered (see gh-3160).
60- pass
61- else:
62- triplet = str(p.communicate()[0].decode().strip())
63- if p.returncode == 0:
64- # gcc supports the "-print-multiarch" option
65- default_x11_lib_dirs += [os.path.join("/usr/lib/", triplet)]
66- default_lib_dirs += [os.path.join("/usr/lib/", triplet)]
67- finally:
68- if tmp is not None:
69- tmp.close()
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050070+ default_x11_lib_dirs = libpaths(['/deaddir/lib'], platform_bits)
71+ default_x11_include_dirs = ['/deaddir/include']
72
73 if os.path.join(sys.prefix, 'lib') not in default_lib_dirs:
74 default_lib_dirs.insert(0, os.path.join(sys.prefix, 'lib'))