Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 1 | From 672a75c8417ce08db9e31fc415ec445479231d5a Mon Sep 17 00:00:00 2001 |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 2 | From: Alexander Kanavin <alex.kanavin@gmail.com> |
| 3 | Date: Thu, 10 Dec 2015 13:20:30 +0200 |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 4 | Subject: [PATCH] Don't search /usr and so on for libraries by default to |
| 5 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 6 | avoid host contamination. |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 7 | |
| 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> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 11 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 12 | --- |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 13 | numpy/distutils/system_info.py | 42 ++++------------------------------ |
| 14 | 1 file changed, 5 insertions(+), 37 deletions(-) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 15 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 16 | diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 17 | index ba2b1f4..f94dce1 100644 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 18 | --- a/numpy/distutils/system_info.py |
| 19 | +++ b/numpy/distutils/system_info.py |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 20 | @@ -278,45 +278,13 @@ if sys.platform == 'win32': |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 21 | add_system_root(os.path.join(conda_dir, 'Library')) |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 22 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 23 | else: |
| 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'] |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 34 | - |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 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', |
| 38 | - '/usr/include'] |
| 39 | - |
| 40 | - if os.path.exists('/usr/lib/X11'): |
| 41 | - globbed_x11_dir = glob('/usr/lib/*/libX11.so') |
| 42 | - if globbed_x11_dir: |
| 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']) |
| 47 | - |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 48 | - with open(os.devnull, 'w') as tmp: |
| 49 | - try: |
| 50 | - p = subprocess.Popen(["gcc", "-print-multiarch"], stdout=subprocess.PIPE, |
| 51 | - stderr=tmp) |
| 52 | - except (OSError, DistutilsError): |
| 53 | - # OSError if gcc is not installed, or SandboxViolation (DistutilsError |
| 54 | - # subclass) if an old setuptools bug is triggered (see gh-3160). |
| 55 | - pass |
| 56 | - else: |
| 57 | - triplet = str(p.communicate()[0].decode().strip()) |
| 58 | - if p.returncode == 0: |
| 59 | - # gcc supports the "-print-multiarch" option |
| 60 | - default_x11_lib_dirs += [os.path.join("/usr/lib/", triplet)] |
| 61 | - default_lib_dirs += [os.path.join("/usr/lib/", triplet)] |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 62 | + default_lib_dirs = libpaths(['/deadir/lib'], platform_bits) |
| 63 | + default_include_dirs = ['/deaddir/include'] |
| 64 | + default_src_dirs = ['.', '/deaddir/src'] |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 65 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 66 | + default_x11_lib_dirs = libpaths(['/deaddir/lib'], platform_bits) |
| 67 | + default_x11_include_dirs = ['/deaddir/include'] |
| 68 | |
| 69 | if os.path.join(sys.prefix, 'lib') not in default_lib_dirs: |
| 70 | default_lib_dirs.insert(0, os.path.join(sys.prefix, 'lib')) |