python 2.3.3 setup.py: why adding sys.prefix to include_dir, libdir?

H

Holger Joukl

Hi there,
2 questions regarding build/installation issues:

1. In the python 2.3.3 setup.py script, the detect_modules method of
class PyBuildExt contains the following code:

253 if os.path.normpath(sys.prefix) != '/usr':
254 add_dir_to_list(self.compiler.library_dirs,
255 sysconfig.get_config_var("LIBDIR"))
256 add_dir_to_list(self.compiler.include_dirs,
257 sysconfig.get_config_var("INCLUDEDIR"))

This basically just adds the PREFIX/lib and PREFIX/include to
self.compiler.library_dirs
and self.include_dirs, PREFIX being what I gave to configure as command
line argument, e.g.:
../configure --prefix=/opt/tools --with-cxx=gcc

I understand the --prefix=PREFIX sets the installation _target_ directory.
Does it make sense to have these paths in include_dirs/library_dirs? Why
would I want this?
In fact, as it turned out that I had some bogus header files in the PREFIX
directory, an
extension module would not compile.

2. As a lot of things do not live in the "standard" places in our
environment, there seem to be several
places where I have to change setup.py manually. E.g. adding runtime
library dirs for curses, gdbm etc.
Is there another way to achieve correct build, in terms of telling my
non-standard paths to configure
in the first place? Just to spare me from changing setup.py...

Any comments are appreciated.
Best regards
Holger

_________________________________

Holger Joukl
Landesbank Baden-Württemberg
1651 Financial Markets Technologies
fon +49 (711) 124 - 7078
fax +49 (711) 124 - 3759
_________________________________

Der Inhalt dieser E-Mail ist vertraulich. Falls Sie nicht der angegebene
Empfänger sind oder falls diese E-Mail irrtümlich an Sie adressiert wurde,
verständigen Sie bitte den Absender sofort und löschen Sie die E-Mail
sodann. Das unerlaubte Kopieren sowie die unbefugte Übermittlung sind nicht
gestattet. Die Sicherheit von Übermittlungen per E-Mail kann nicht
garantiert werden. Falls Sie eine Bestätigung wünschen, fordern Sie bitte
den Inhalt der E-Mail als Hardcopy an.

The contents of this e-mail are confidential. If you are not the named
addressee or if this transmission has been addressed to you in error,
please notify the sender immediately and then delete this e-mail. Any
unauthorized copying and transmission is forbidden. E-Mail transmission
cannot be guaranteed to be secure. If verification is required, please
request a hard copy version.
 
M

Michael Hudson

Holger Joukl said:
Hi there,
2 questions regarding build/installation issues:

1. In the python 2.3.3 setup.py script, the detect_modules method of
class PyBuildExt contains the following code:

253 if os.path.normpath(sys.prefix) != '/usr':
254 add_dir_to_list(self.compiler.library_dirs,
255 sysconfig.get_config_var("LIBDIR"))
256 add_dir_to_list(self.compiler.include_dirs,
257 sysconfig.get_config_var("INCLUDEDIR"))

This basically just adds the PREFIX/lib and PREFIX/include to
self.compiler.library_dirs
and self.include_dirs, PREFIX being what I gave to configure as command
line argument, e.g.:
./configure --prefix=/opt/tools --with-cxx=gcc

I understand the --prefix=PREFIX sets the installation _target_ directory.
Does it make sense to have these paths in include_dirs/library_dirs? Why
would I want this?

Well, to work completely out of the box setup.py would need to be
telepathic, omniscient and be able to see into the future. We're
working on that <wink>, but not there yet.

So I wouldn't regard having to hand-hack setup.py as being in
particularly bad taste.
In fact, as it turned out that I had some bogus header files in the
PREFIX directory, an extension module would not compile.

Well, might I suggest not installing broken headers on your system? I
mean, I can think of real reasons for not wanting $(prefix) on the
search path, but not this one.
2. As a lot of things do not live in the "standard" places in our
environment,

What is your environment, out of curiosity?
there seem to be several places where I have to change setup.py
manually. E.g. adding runtime library dirs for curses, gdbm etc. Is
there another way to achieve correct build, in terms of telling my
non-standard paths to configure in the first place?

Er, no, or at least not in general. Editing Modules/Setup is another
option...
Just to spare me from changing setup.py...

.... as is submitting patches to SF that make setup.py look in these
places, if they are in fact "standard" for your environment but not
for, say, Red Hat Linux.

Cheers,
mwh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top