[SciPy-dev] PATCH: scipy_distutils/system_info.py
David M. Cooke
cookedm at physics.mcmaster.ca
Mon May 27 15:24:03 EDT 2002
At some point, Pearu Peterson <pearu at cens.ioc.ee> wrote:
> Hi,
>
> Regarding this patch I have made the following changes.
>
[...]
> Dropped using 'extra_objects' as it was buggy from the start and unified
> hooks for static (.a) and dynamic (.so) libriaries.
[...]
> Renamed static_first to search_static_first and set its default value to
> 0. If someone really needs it, let me know. Otherwise search_static_first
> hooks will be removed in future. I find it quite useless because systems
> prefer shared libraries to static libraries (if they are in the same
> directory) and Python extension modules are always shared libraries
> anyway and I don't believe in speed improvement when linking against
> static libraries in this situation.
Ok, I looked over your changes and they look ok. But I have one
quibble: the use of shortest_path(). If there are two copies of a
library 'libx.so' in different directories, say /usr/local/lib and
/opt/lib, and the search paths have been specified so that
/usr/local/lib comes before /opt/lib (as it does in default_lib_dirs),
then shortest_path() will select '/opt/lib/libx.so' instead of the
preferred '/usr/local/lib/libx.so'. But here's a replacement that
should choose the right one, preferring '/usr/local/lib/libx.so' over
'/opt/lib/libx.so' and '/usr/local/lib/libx.so.6'
def shortest_path(pths):
if not pths:
return None
dir = os.path.dirname(pths[0])
pths = [(len(p), p) for p in pths if os.path.dirname(p) == dir]
return min(pths)[1]
--
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm at physics.mcmaster.ca
More information about the SciPy-Dev
mailing list