[Distutils] CWD when running compilers

amk at amk.ca amk at amk.ca
Mon Oct 27 09:30:29 EST 2003


I've come across a situation that may be a Distutils bug, but I'm unsure
if it's a bug or not.

When Distutils runs a compiler subprocess, the current working directory is
left alone so, in the absence of os.chdir() calls in the setup.py, it's the
same directory as the setup.py script.  If the source file is in a
subdirectory (e.g. src/constants.c), the CWD is therefore different from the
directory containing the source file.

In C you can use relative #include paths, e.g.  #include
<../../hydra/mbv_sched/common.h>.  If the source file contains such a
relative #include, it's natural to start from the directory containing the
header or the source file; this is wrong, however.  

Question: is this a bug in Distutils?  Should distutils.spawn change the CWD
to the same directory as the source?  

--amk




More information about the Distutils-SIG mailing list