Survey of complex usage of distutils.

eltronic at juno.com eltronic at juno.com
Fri May 16 00:02:58 EDT 2003


On Thu, 15 May 2003 13:51:36 +1000 Anthony Baxter
<anthony at interlink.com.au> writes:
> I'm currently documenting the Distutils innards 
 
distutils probably gets blamed for problems 
it has no way of solving.
 
python setup.py build --compiler=mingw32 
obvious once you know it, but it did take me awhile to
find this switch. I did get the libpython22.a built,
but I just found out last week that the reason I could
never compile an extension is pexport, reimp or whatever
I was using before wasn't getting the job done. I always
had unresolved symbols which appeared to be available.
 
the description in the Python Cookbook  82826 page works.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82826
HOW TO DEBUG PYTHON EXTENSIONS ON WINDOWS WITH OPEN SOURCE TOOLS 
Dll2Def utility http://users.ncrvnet.nl/gmvdijk/packages.html
 
gcc is able to handle either forward slash or standard 
dos paths from a dos window running setup.py
scipy does some subclassing of distutils, but has 
the same problem constructing paths on the msys shell.
setup.py install seems to work fine on dos or msys,
if not building c extensions.
 
I did see something on the distutils-sig about backporting 
to 2.2, does that mean cvs isn't going to work with 2.2 yet?
I wasn't able to run the cvs version. as it turns out 
that wouldent solve these problems either.
 
I add this if to setup.py
# __import__ recommended on c.l.p 
if os.getenv('MSYSTEM','nope')=='MINGW32':
    os.path = __import__('posixpath')
    os.sep='/'
 
this helps a little but there are still a few problems 
when run from the msys shell instead of the dos window. 
everyone makes assumptions on platform win32 that paths 
should be typical drive:\path\file.ext
somehow the full path to gcc is getting added, not necessary
and wrong. gcc would be fine but setup.py produces a 
bad -Lpath as well run from msys
msys is a bash shell for windows.
available on the mingw download page, 
I would guess there are similar problems from cygwin.
 
this is the line setup.py produces when run from msys:
L:/c/MinGW/bin\gcc.exe -mno-cygwin -mdll -O -Wall 
-IL:\C\PYTHON22\include -c logilab/hmm/_hmm.c 
-o build\temp.win32-2.2\Release\_hmm.o
 
notice some of the slashes are forward with the changes 
in setup.py above. but there is no consistency.
if I edit by hand * run manually
 
gcc.exe -mno-cygwin -mdll -O -Wall -DMS_WINDOWS=1 -I/L/C/PYTHON22/include
-c 
logilab/hmm/_hmm.c -o build/temp.win32-2.2/Release/_hmm.o
 
and rerun setup.py it skips the compile,
but the same problem shows up the in the dllwrap line
which I can edit and run and the pyd is built.
 
so we just need an easy way to override the default 
lib path and drop the full path to the bin directory.
 
optionally changes to os.py or something in sitecustomize.py
but I don't know what I could easily do there.
setup.py --help --kitkabootle
would dump everything distutils knows about anything
setup.py doesn't support anything like add/remove programs.
this makes setup.py for new versions potentially buggy.
 
I know distutils is being extended to download as well as
build and install so probably there is a local distutils config
which I'm neglecting to use which can solve these problems.
yes, its mentioned in a pdf not included in the distribution.
 
configuration file, setup.cfg
well, it infers you can't specify overriding options 
just additional options.
can I specify alternate setup.cfg from the commandline?
 
unlike the python ideal, 
in the absence of information I must guess.
 
[commands]
cmt='still have the same dos vrs msys vrs other compiler problem'
include_dirs=/L/C/puthon22/include
 
same problem, and include_dirs ignored
ok, I must giveup for now...
 
 
 
 
 
 
 
e

________________________________________________________________
The best thing to hit the internet in years - Juno SpeedBand!
Surf the web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!





More information about the Python-list mailing list