[Distutils] a couple of distutils questions
Toby Sargeant
t.sargeant@inpharmatica.co.uk
Tue Jun 26 06:11:01 2001
This is my first use of the distutils package, so I accept that I might have
gone about things the wrong way.
Initially for my freetype 2 extension module, I used autoconf to build a
Setup.in file for building the module. I decided to switch to using distutils
recently, and in doing so wanted to still be able to provide the
--freetype-path and --with-pil-headers options to deal with different install
locations for freetype and PIL.
After a lot of poking around and many false starts, it seemed that there wasn't
a good way to handle command line arguments that didn't involve extensive
poking around in internal distutils objects.
Eventually I gave up and just used the following code:
handle={
'--freetype-path=' : optFreetypePath,
'--with-pil-headers=' : optPilHeaders
}
arg=1
while arg<len(sys.argv):
for k,v in handle.items():
if sys.argv[arg][:len(k)]==k:
if v is not None:
v(sys.argv[arg][len(k):])
del sys.argv[arg]
break
else:
arg=arg+1
which seems like a rather large hack to me. What's the preferred distutils
approach?
Additionally, I noticed that the Extension object takes a
runtime_library_path option, but the unixcompiler object spits out a
-R/my/path option, which gcc doesn't like. Using extra_link_args seems
like a sure way to tie yourself down to one compiler, though, so I'm not
sure what I can do in this case.
Toby.
--
[ Toby Sargeant : Inpharmatica : Developer : t.sargeant@inpharmatica.co.uk ]
[ http://www.inpharmatica.co.uk : 020 7074 4600 fax 020 7631 4844 ]