[Python-bugs-list] [ python-Bugs-459423 ] setup.py ignores OPT make variable (original) (raw)

noreply@sourceforge.net noreply@sourceforge.net
Thu, 18 Oct 2001 18:03:32 -0700


Bugs item #459423, was opened at 2001-09-06 23:23 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=105470&aid=459423&group_id=5470

Category: None

Group: Not a Bug Status: Closed Resolution: None Priority: 5 Submitted By: Skip Montanaro (montanaro) Assigned to: Nobody/Anonymous (nobody) Summary: setup.py ignores OPT make variable

Initial Comment: If you build Python using something like

make OPT=-O6

when it gets around to building the extension modules it's forgotten (or it ignores) OPT:

$ make OPT=-O3
PYTHONPATH= ./python ../setup.py build
running build
running build_ext
building 'struct' extension
gcc -g -O2 -Wall -Wstrict-prototypes -fPIC -I.

-I/home/skip/src/Python-2.1.1/./Include -I/usr/local/include -IInclude/ -c /home/skip/src/Python-2.1.1/Modules/structmodule.c -o build/temp.linux-i686-2.1/structmodule.o gcc -shared build/temp.linux-i686-2.1/structmodule.o -L/usr/local/lib -o build/lib.linux-i686-2.1/struct.so ...

Shouldn't setup.py recognize and use the value of OPT?


Comment By: Skip Montanaro (montanaro) Date: 2001-10-18 18:03

Message: Logged In: YES user_id=44345

I think I finally concluded (probably after getting beat up about something similar by the Gtk folks) that the correct thing to do is to pass the desired OPT setting to the configure script. That way the Makefile is generated with the correct settings that setup.py then extracts.

Marking as not-a-bug and closing...

(Can you add "it's a feature" to the list of possible groups? ;-)


Comment By: Guido van Rossum (gvanrossum) Date: 2001-10-18 17:48

Message: Logged In: YES user_id=6380

Apparently setup.py doesn't pull OPT out of the environment; I added OPT='$(OPT)' to the command that invokes setup.py build, but it still built with the default OPT values.


Comment By: Martin v. L�wis (loewis) Date: 2001-09-07 17:04

Message: Logged In: YES user_id=21627

GNU make does indeed pass all make variables to subprocesses. According to the recent POSIX drafts, this behaviour is in clear violation to POSIX make behaviour, see #438786 for details.

So if anything is done to get OPT from the environment, you also need to pass it from the make variable to the environment of the subprocess, for it to work on all systems.


Comment By: Skip Montanaro (montanaro) Date: 2001-09-07 09:32

Message: Logged In: YES user_id=44345

I recall that GNU make at least passes variables to sub-makes in the environment. Perhaps it does that for all programs it forks. If so, then setup.py should be able to read OPT and other interesting bits from the environment. Also, perhaps configure can be made to set OPT in the Makefile if it's found when it runs.

I don't have time to look into this today but if it's not taken care of by the weekend I'll try to fix it.


Comment By: Guido van Rossum (gvanrossum) Date: 2001-09-07 05:34

Message: Logged In: YES user_id=6380

The setup.py script reads the Makefile but has no access to the options you pass dynamically to Make. I'm not sure it's worth fixing. You can edit the Makefile instead.

But I'm not setup.py's maintainer, so I'll shut up now. :-)


You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=105470&aid=459423&group_id=5470