[Distutils] Distutils.sysconfig.customize_compiler wrong ?

rupert.thurner rupert.thurner at gmail.com
Fri May 22 18:22:03 CEST 2009


# python
Python 2.6.1 (r261:67515, Mar  2 2009, 14:14:28) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.

from distutils.ccompiler import new_compiler
compiler = new_compiler(None,None,None,None)
compiler.compiler_type='unix'
from distutils.sysconfig import customize_compiler
customize_compiler(compiler)
compiler.linker_so
['/opt/studio/SOS11/SUNWspro/bin/cc', '-G']
compiler.compiler
['/opt/SUNWspro/bin/cc', '-DNDEBUG', '-O']

export LDSHARED=/opt/SUNWspro/bin/cc
python
>>> from distutils.ccompiler import new_compiler
>>> compiler = new_compiler(None,None,None,None)
>>> compiler.compiler_type='unix'
>>> from distutils.sysconfig import customize_compiler
>>> customize_compiler(compiler)
>>> compiler.linker_so
['/opt/SUNWspro/bin/cc']

and the option "-G" is gone ?

export LDFLAGS=-G as well does the job. but i am wondering if all of
this is the intention ?

rupert.



On May 22, 5:26 pm, "rupert.thurner" <rupert.thur... at gmail.com> wrote:
> ah ... found it. but i do not make any progress with debugging.
> somehow it seems to use the correct compiler while compiling but not
> when linking.
>
> /cs/SUNWspro/bin/cc -DNDEBUG -O -xO3 -xarch=v8 -DHAVE_LIBJPEG -
> DHAVE_LIBZ -DWORDS_BIGENDIAN -I/opt/csw/include/freetype2 -IlibImaging
> -I/opt/csw/include -I/usr/include -I/opt/csw/include/python2.6 -c
> libImaging/ZipEncode.c -o build/temp.solaris-2.10-sun4v-2.6/libImaging/
> ZipEncode.o
> /opt/studio/SOS11/SUNWspro/bin/cc -G build/temp.solaris-2.10-sun4v-2.6/
> _imaging.o build/temp.solaris-2.10-sun4v-2.6/decode.o
> <cut> ...
> -L/usr/lib -ljpeg -lz -lpython2.6 -o build/lib.solaris-2.10-sun4v-2.6/
> _imaging.so
>
> rupert.
>
> On May 22, 4:13 pm, Tarek Ziadé <ziade.ta... at gmail.com> wrote:
>
> > On Fri, May 22, 2009 at 4:07 PM, rupert.thurner
>
> > <rupert.thur... at gmail.com> wrote:
> > > On May 22, 3:41 pm, Tarek Ziadé <ziade.ta... at gmail.com> wrote:
> > >> On Fri, May 22, 2009 at 3:36 PM, rupert.thurner
>
> > >> <rupert.thur... at gmail.com> wrote:
> > >> > are you sure you are not violating something here?
>
> > >> What do you mean ?
> > > the "This function is even more special-purpose, and should only be
> > > used
> > > from Python’s own build procedures. "
>
> > As a matter of fact, Python uses build_ext when it's built.  What the
> > documentation means
> > here is that you should not use customize_compiler in your code, but
> > through build_ext
> > and a few other commands in Python's distutils.
>
> > I agree it's not very clear though, and that it should be made private
> > with a "_"
>
> > >> > the packager of our operating systems python had the compiler in /opt/
> > >> > studio/... but we do not.
>
> > >> build_ext will pick the CC it finds in the Makefile but overrides it if one
> > >> is set in os.environ['CC']
>
> > > i cannot find it in the code ... but it seems to work on the top level
> > > but is not passed on, so i wonder where in the code this is ?
>
> > It's in distutils code, not setuptools. Setuptools is a layer on the
> > top of distutils.
> > _______________________________________________
> > Distutils-SIG maillist  -  Distutils-... at python.orghttp://mail.python.org/mailman/listinfo/distutils-sig
>
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-... at python.orghttp://mail.python.org/mailman/listinfo/distutils-sig


More information about the Distutils-SIG mailing list