File: distutils-link.diff

package info (click to toggle)
python3.9 3.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 102,508 kB
  • sloc: python: 606,145; ansic: 515,486; xml: 31,209; sh: 4,917; cpp: 3,781; makefile: 1,885; asm: 1,486; objc: 761; lisp: 502; pascal: 360; javascript: 177; csh: 11
file content (24 lines) | stat: -rw-r--r-- 1,217 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# DP: Don't add standard library dirs to library_dirs and runtime_library_dirs.

Index: b/Lib/distutils/unixccompiler.py
===================================================================
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -155,6 +155,17 @@ class UnixCCompiler(CCompiler):
                                         runtime_library_dirs)
         libraries, library_dirs, runtime_library_dirs = fixed_args
 
+        # filter out standard library paths, which are not explicitely needed
+        # for linking
+        system_libdirs = ['/lib', '/lib64', '/usr/lib', '/usr/lib64']
+        multiarch = sysconfig.get_config_var("MULTIARCH")
+        if multiarch:
+            system_libdirs.extend(['/lib/%s' % multiarch, '/usr/lib/%s' % multiarch])
+        library_dirs = [dir for dir in library_dirs
+                        if not dir in system_libdirs]
+        runtime_library_dirs = [dir for dir in runtime_library_dirs
+                                if not dir in system_libdirs]
+
         lib_opts = gen_lib_options(self, library_dirs, runtime_library_dirs,
                                    libraries)
         if not isinstance(output_dir, (str, type(None))):