[Pythonmac-SIG] Another build question: ssl?

Dan Wolfe dkwolfe@pacbell.net
Thu, 21 Nov 2002 23:58:31 -0800


It's been a long day, and I can honestly say that I don't have a handle 
on distutils yet... and that's holding me back from endorsing this 
idea... even though I like it... and agree with it in principle....

Here's why:

The current code (python 2.2.2) in the compiler (at least the 
unixcompiler.py) returns the just the path to the library if it exists 
otherwise it returns None.

The current code in setup.py relies on the find_file() located right 
above the find_library_file().  The find_file() only returns the full 
pathname to the library if it's located in the std_dirs.  If the file 
is found in one of the additional paths it returns the directory that 
contains the library rather than the full path.

In the code below, if I'm reading this right, if the file is found and 
the path appears in both the std_dir and paths parameters, it will 
return a directory instead of the current code's full path the the 
library. Whether this will break something else, I'm not sure....

I was, also wondering last night why distutils made a design decision 
to write the function that acted differently with the same name... and 
whether this additional functionality was in use anywhere.  If it's 
not, it probably be a good idea to simplify things and just rely on the 
compiler version....

And the other distutils question that I had, is whether the code needs 
to be backwardly compatible or not... (eg is it ok to use the new 
string.startswith() and += operatives?) for use with python 2.1?

- Dan

On Thursday, November 21, 2002, at 12:25  PM, Andrew Kuchling wrote:

> On Thu, Nov 21, 2002 at 11:20:15AM -0800, Dan Wolfe wrote:
>> Below is a diff that fixes the problem simply by adding another check
>> for a dylib file and returning the results if it exists.
>
> I think a better fix would be to make the setup.py function use the
> compiler method of the same name, by putting this in setup.py instead
> of the existing function:
>
> def find_library_file(compiler, libname, std_dirs, paths):
>     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 additional 
> directories
>     for p in paths:
>         # Ensure path ends with path separator
>         if not p.endswith(os.sep):
>             p += os.sep
>         if result.startswith(p):
>             return [p]
>
>     return []
>
> Otherwise a similar bug can show up again down the road if there's a
> fourth kind of shared library.  I can't get to my Mac at the moment;
> anyone want to test this?  (Otherwise I'll test it this evening...)
>
> --amk                                                             
> (www.amk.ca)
>     "So what's so terrible about Perivale?"
>     "Nothing ever happens here."
>       -- The Doctor and Ace, in "Survival"
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>