summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2002-11-27 13:43:46 +0000
committerAndrew M. Kuchling <amk@amk.ca>2002-11-27 13:43:46 +0000
commita246d9fefd729294e84a190f2e92cf4e4ff08f20 (patch)
tree41b2c11eaacd2747ec53fc9d5ad81bf3fc354a2e
parentd680a862063535ddd92fdb0c99eb969518033d91 (diff)
downloadcpython-git-a246d9fefd729294e84a190f2e92cf4e4ff08f20.tar.gz
[Patch #641685] setup.py contained code for finding libraries, instead
of using the CCompiler.find_library_file() provided by the Distutils. This patch fixes it to use the Distutils method at the cost of some additional glue. (The duplication resulted in the SSL module not being automatically built on Macs; the Distutils knew that shared libraries on OS X have a .dylib extension, but the setup.py code didn't.)
-rw-r--r--setup.py32
1 files changed, 24 insertions, 8 deletions
diff --git a/setup.py b/setup.py
index 12cbf2c4ce..1240ed989f 100644
--- a/setup.py
+++ b/setup.py
@@ -48,14 +48,30 @@ def find_file(filename, std_dirs, paths):
return None
def find_library_file(compiler, libname, std_dirs, paths):
- filename = compiler.library_filename(libname, lib_type='shared')
- result = find_file(filename, std_dirs, paths)
- if result is not None: return result
-
- filename = compiler.library_filename(libname, lib_type='static')
- result = find_file(filename, std_dirs, paths)
- return result
-
+ result = compiler.find_library_file(std_dirs + paths, libname)
+ if result is None:
+ return None
+
+ # Check whether the found file is in one of the standard directories
+ dirname = os.path.dirname(result)
+ for p in std_dirs:
+ # Ensure path doesn't end with path separator
+ if p.endswith(os.sep):
+ p = p.strip(os.sep)
+ if p == dirname:
+ return [ ]
+
+ # Otherwise, it must have been in one of the additional directories,
+ # so we have to figure out which one.
+ for p in paths:
+ # Ensure path doesn't end with path separator
+ if p.endswith(os.sep):
+ p = p.strip(os.sep)
+ if p == dirname:
+ return [p]
+ else:
+ assert False, "Internal error: Path not found in std_dirs or paths"
+
def module_enabled(extlist, modname):
"""Returns whether the module 'modname' is present in the list
of extensions 'extlist'."""