Summary: | python's distutils does not respect CXXFLAGS | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | SpanKY <vapier> |
Component: | Current packages | Assignee: | Python Gentoo Team <python> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | dsdale24, markus, rhill |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 212178 | ||
Attachments: |
distutils uses CXXFLAGS instead of CFLAGS for C++ files
fixed some strange things in my last patch (irrelevant code) Better language detection The difference between last two revisions I made. |
Description
SpanKY
2006-08-26 15:11:02 UTC
i took a look at this and i can't find where CFLAGS gets picked up by the build system. the only place that it seems to even look is in config.py: cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] which still wouldn't use CFLAGS. unless it gets this info from swig somehow. i'm guessing this is distutils failing /usr/lib/python2.5/distutils/sysconfig.py this checks CFLAGS, CPPFLAGS, and LDFLAGS -- no CXXFLAGS Created attachment 148178 [details, diff]
distutils uses CXXFLAGS instead of CFLAGS for C++ files
I added "-include killcpp.h" to CFLAGS, where killcpp.h contained illegal c++ code, but valid c. emerge finished, so I'm pretty sure my solution worked :) I'm pretty sure it's correct, but I hope somebody with more python skills can look it over.
I hope nobody minds that I patched against python-2.5.2, but that's what I have installed, and I need some sleep.
Comment on attachment 148178 [details, diff]
distutils uses CXXFLAGS instead of CFLAGS for C++ files
strangeness crept in
Created attachment 148180 [details, diff]
fixed some strange things in my last patch (irrelevant code)
@Mark: nice job. The patch I started working on was meant to do the same but you were a bit faster. I guess it can be included as it is. where did you get the .c/.m list of types ? there are other types which should go through the C compiler, but i think it may be saner to flip the logic ... hard code the list for C++, and have everything else go through C ... otherwise, thanks, it looks good :) Created attachment 148946 [details, diff]
Better language detection
Maybe this is more what you're looking for. I found a function detect_language() that uses a map of extension -> language. Below is a patch from my previous revision to this one.
Created attachment 148947 [details, diff]
The difference between last two revisions I made.
ah, very nice ... that looks good to me +*python-2.5.2 (18 Apr 2008) +*python-2.4.4-r10 (18 Apr 2008) +*python-2.3.6-r5 (18 Apr 2008) + + 18 Apr 2008; Ali Polatel <hawking@gentoo.org> +python-2.3.6-r5.ebuild, + +python-2.4.4-r10.ebuild, +python-2.5.2.ebuild: + Version bumps. Updated patchsets to fix buffer overflow in zlib extension + (CVE-2008-1721) bug 217221 and unsafe PyString_FromStringAndSize(). Added + patch by Mark Peloquin for distutils to respect CXXFLAGS, bug 145206. Add + wininst USE flag to conditionally install MS Windows executables, bug + 198021. Use EAPI=1, rename nothreads and nocxx USE flags to threads and + cxx. + Thanks Mark, I've included your patch to our patchset. Yikes, this patch breaks distutils if CXXFLAGS is not defined. I discovered it when I tried to compile matplotlib outside of portage. Distutils fails with the following traceback: Traceback (most recent call last): File "setup.py", line 277, in <module> **additional_params File "/usr/lib64/python2.5/distutils/core.py", line 151, in setup dist.run_commands() File "/usr/lib64/python2.5/distutils/dist.py", line 974, in run_commands self.run_command(cmd) File "/usr/lib64/python2.5/distutils/dist.py", line 994, in run_command cmd_obj.run() File "/usr/lib64/python2.5/distutils/command/build.py", line 112, in run self.run_command(cmd_name) File "/usr/lib64/python2.5/distutils/cmd.py", line 333, in run_command self.distribution.run_command(command) File "/usr/lib64/python2.5/distutils/dist.py", line 994, in run_command cmd_obj.run() File "/usr/lib64/python2.5/distutils/command/build_ext.py", line 265, in run customize_compiler(self.compiler) File "/usr/lib64/python2.5/distutils/sysconfig.py", line 177, in customize_compiler cxx_cmd = cxx + ' ' + cxxflags TypeError: cannot concatenate 'str' and 'NoneType' objects If I define CXXFLAGS, I can compile again. 2.5.2-r2 and 2.4.4-r11 fixes that. |