blob: 9f5f25f9b57c96f51bfa88a66bebcfff48060f0b [file] [log] [blame]
Andrew Geissler475cb722020-07-10 16:00:51 -05001From 27f6687e49bf555fc494d2f14bae6ecd0fa30f14 Mon Sep 17 00:00:00 2001
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05002From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Thu, 10 Dec 2015 13:20:30 +0200
Brad Bishopc342db32019-05-15 21:57:59 -04004Subject: [PATCH] Don't search /usr and so on for libraries by default to
5
Brad Bishop316dfdd2018-06-25 12:45:53 -04006 avoid host contamination.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05007
8Upstream-Status: Inappropriate (As the code stands, this is a hack)
9Signed-off-by: Ross Burton <ross.burton@intel.com>
10Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
11---
Andrew Geissler5f350902021-07-23 13:09:54 -040012 numpy/distutils/system_info.py | 42 +++++-----------------------------
13 1 file changed, 6 insertions(+), 36 deletions(-)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050014
Brad Bishop316dfdd2018-06-25 12:45:53 -040015diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
Andrew Geissler5f350902021-07-23 13:09:54 -040016index 82e864a..135246d 100644
Brad Bishop316dfdd2018-06-25 12:45:53 -040017--- a/numpy/distutils/system_info.py
18+++ b/numpy/distutils/system_info.py
Andrew Geissler5f350902021-07-23 13:09:54 -040019@@ -323,44 +323,14 @@ if sys.platform == 'win32':
Andrew Geissler475cb722020-07-10 16:00:51 -050020 add_system_root(os.path.join(conda_dir, 'Library'))
Brad Bishopc342db32019-05-15 21:57:59 -040021
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050022 else:
23- default_lib_dirs = libpaths(['/usr/local/lib', '/opt/lib', '/usr/lib',
24- '/opt/local/lib', '/sw/lib'], platform_bits)
25 default_runtime_dirs = []
26- default_include_dirs = ['/usr/local/include',
Andrew Geissler5f350902021-07-23 13:09:54 -040027- '/opt/include',
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050028- # path of umfpack under macports
29- '/opt/local/include/ufsparse',
30- '/opt/local/include', '/sw/include',
31- '/usr/include/suitesparse']
32- default_src_dirs = ['.', '/usr/local/src', '/opt/src', '/sw/src']
Brad Bishop316dfdd2018-06-25 12:45:53 -040033-
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050034- default_x11_lib_dirs = libpaths(['/usr/X11R6/lib', '/usr/X11/lib',
35- '/usr/lib'], platform_bits)
Andrew Geissler5f350902021-07-23 13:09:54 -040036- default_x11_include_dirs = ['/usr/X11R6/include', '/usr/X11/include']
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050037-
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-
Brad Bishop79641f22019-09-10 07:20:22 -040046- with open(os.devnull, 'w') as tmp:
47- try:
48- p = subprocess.Popen(["gcc", "-print-multiarch"], stdout=subprocess.PIPE,
49- stderr=tmp)
50- except (OSError, DistutilsError):
51- # OSError if gcc is not installed, or SandboxViolation (DistutilsError
52- # subclass) if an old setuptools bug is triggered (see gh-3160).
53- pass
54- else:
55- triplet = str(p.communicate()[0].decode().strip())
56- if p.returncode == 0:
57- # gcc supports the "-print-multiarch" option
58- default_x11_lib_dirs += [os.path.join("/usr/lib/", triplet)]
59- default_lib_dirs += [os.path.join("/usr/lib/", triplet)]
Andrew Geissler5f350902021-07-23 13:09:54 -040060
Brad Bishop316dfdd2018-06-25 12:45:53 -040061+ default_lib_dirs = libpaths(['/deadir/lib'], platform_bits)
62+ default_include_dirs = ['/deaddir/include']
63+ default_src_dirs = ['.', '/deaddir/src']
Andrew Geissler5f350902021-07-23 13:09:54 -040064+
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050065+ default_x11_lib_dirs = libpaths(['/deaddir/lib'], platform_bits)
66+ default_x11_include_dirs = ['/deaddir/include']
67
68 if os.path.join(sys.prefix, 'lib') not in default_lib_dirs:
69 default_lib_dirs.insert(0, os.path.join(sys.prefix, 'lib'))
Andrew Geissler475cb722020-07-10 16:00:51 -050070--
Andrew Geissler5f350902021-07-23 13:09:54 -0400712.25.1
Andrew Geissler475cb722020-07-10 16:00:51 -050072