Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | From c8c6649b29a08f82e1d6761a6d62ce5f632313c5 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 | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 4 | Subject: [PATCH 1/3] Don't search /usr and so on for libraries by default to |
| 5 | avoid host contamination. |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 6 | |
| 7 | Upstream-Status: Inappropriate (As the code stands, this is a hack) |
| 8 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
| 9 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 10 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 11 | --- |
| 12 | numpy/distutils/system_info.py | 50 +++++------------------------------------- |
| 13 | 1 file changed, 6 insertions(+), 44 deletions(-) |
| 14 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 15 | diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py |
| 16 | index bea120c..544e056 100644 |
| 17 | --- a/numpy/distutils/system_info.py |
| 18 | +++ b/numpy/distutils/system_info.py |
| 19 | @@ -262,51 +262,13 @@ if sys.platform == 'win32': |
| 20 | add_system_root(os.path.join(conda_dir, 'Library')) |
| 21 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 22 | 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', |
| 27 | - '/opt/include', '/usr/include', |
| 28 | - # 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 Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 33 | - |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 34 | - default_x11_lib_dirs = libpaths(['/usr/X11R6/lib', '/usr/X11/lib', |
| 35 | - '/usr/lib'], platform_bits) |
| 36 | - default_x11_include_dirs = ['/usr/X11R6/include', '/usr/X11/include', |
| 37 | - '/usr/include'] |
| 38 | - |
| 39 | - if os.path.exists('/usr/lib/X11'): |
| 40 | - globbed_x11_dir = glob('/usr/lib/*/libX11.so') |
| 41 | - if globbed_x11_dir: |
| 42 | - x11_so_dir = os.path.split(globbed_x11_dir[0])[0] |
| 43 | - default_x11_lib_dirs.extend([x11_so_dir, '/usr/lib/X11']) |
| 44 | - default_x11_include_dirs.extend(['/usr/lib/X11/include', |
| 45 | - '/usr/include/X11']) |
| 46 | - |
| 47 | - import subprocess as sp |
| 48 | - tmp = None |
| 49 | - try: |
| 50 | - # Explicitly open/close file to avoid ResourceWarning when |
| 51 | - # tests are run in debug mode Python 3. |
| 52 | - tmp = open(os.devnull, 'w') |
| 53 | - p = sp.Popen(["gcc", "-print-multiarch"], stdout=sp.PIPE, |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 54 | - stderr=tmp) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 55 | - except (OSError, DistutilsError): |
| 56 | - # OSError if gcc is not installed, or SandboxViolation (DistutilsError |
| 57 | - # subclass) if an old setuptools bug is triggered (see gh-3160). |
| 58 | - pass |
| 59 | - else: |
| 60 | - triplet = str(p.communicate()[0].decode().strip()) |
| 61 | - if p.returncode == 0: |
| 62 | - # gcc supports the "-print-multiarch" option |
| 63 | - default_x11_lib_dirs += [os.path.join("/usr/lib/", triplet)] |
| 64 | - default_lib_dirs += [os.path.join("/usr/lib/", triplet)] |
| 65 | - finally: |
| 66 | - if tmp is not None: |
| 67 | - tmp.close() |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 68 | + default_lib_dirs = libpaths(['/deadir/lib'], platform_bits) |
| 69 | + default_include_dirs = ['/deaddir/include'] |
| 70 | + default_src_dirs = ['.', '/deaddir/src'] |
| 71 | + |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 72 | + default_x11_lib_dirs = libpaths(['/deaddir/lib'], platform_bits) |
| 73 | + default_x11_include_dirs = ['/deaddir/include'] |
| 74 | |
| 75 | if os.path.join(sys.prefix, 'lib') not in default_lib_dirs: |
| 76 | default_lib_dirs.insert(0, os.path.join(sys.prefix, 'lib')) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 77 | -- |
| 78 | 2.16.1 |
| 79 | |