Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | From cc2ce6d8b6a3e6e2c8874896c10897034a80cd4f Mon Sep 17 00:00:00 2001 |
| 2 | From: Alexander Kanavin <alex.kanavin@gmail.com> |
| 3 | Date: Thu, 10 Dec 2015 13:20:30 +0200 |
| 4 | Subject: [PATCH] Don't search /usr and so on for libraries by default to avoid |
| 5 | host contamination. |
| 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> |
| 10 | --- |
| 11 | numpy/distutils/system_info.py | 50 +++++------------------------------------- |
| 12 | 1 file changed, 6 insertions(+), 44 deletions(-) |
| 13 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 14 | Index: 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 Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 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'] |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 32 | + default_lib_dirs = libpaths(['/deadir/lib'], platform_bits) |
| 33 | + default_include_dirs = ['/deaddir/include'] |
| 34 | + default_src_dirs = ['.', '/deaddir/src'] |
| 35 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 36 | - 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 Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 56 | - stderr=tmp) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 57 | - 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 Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 70 | + 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')) |