From: Geoffrey H. <ge...@ge...> - 2005-12-13 00:24:12
|
>> BTW, do you think you could add a test to setup.py? I've included >> some of my initial code below, but it's not bullet-proof yet. >> Basically, I'd want setup.py to check "pkg-config --variable=prefix >> openbabel-2.0" (best case) then /usr/local, then /usr, and >> finally ../../src for libraries and include files. This should cover >> the two obvious cases of an independent pyopenbabel.tar.gz and >> something in the source/build directory. > > What do other packages do? I am not used to writing C extensions using > distutils. Surely distutils checks 'the usual locations' for the > library. One problem with providing several different mechanisms is > that > you multiply the numbers of bugs and make them more difficult to track > down. Personally, I would just find out the best way of doing this, > and > force everybody to do it. How about the usual locations followed by > the > location pointed to by the environment variable OpenBabelLib or > something? I haven't written many C/C++ extensions using distutils either -- it does not seem to be as easy to do as Perl, which has many C/C++ modules. Distutils doesn't seem to be able to find "the usual locations" for libraries. Plus the python module probably has two distribution channels right now: as part of openbabel-2.x and hopefully as a separate download. I imagine that the scripting wrappers will need releases more frequently than the main library. > I don't like writing code like shown below as it's really > unportable. It > should run on windows as easily (!) as on Linux/MacOSX. This is a bit > hacky. > > import os > if os.path.isfile(os.path.join("usr","local","lib","libopenbabel.a"): > X > else: > y OK, but Windows isn't going to have libraries in \usr\local\lib. I don't know about Cygwin. Basically, I don't care much about syntax -- it seems like we want a bunch of checks: - Run pkg-config (if it exists) - Check /usr/local and /usr for libopenbabel.a - Check ../../src/ if we might be in the build for libopenbabel. I guess the main problem is that none of us know much about writing a setup.py script with Distutils for libraries. I've done Google searches but haven't turned up much. Any pointers? Thanks, -Geoff |