[Python-bugs-list] [Bug #114439] define_macros ignored when building Extension

noreply@sourceforge.net noreply@sourceforge.net
Thu, 14 Sep 2000 08:44:41 -0700


Bug #114439, was updated on 2000-Sep-14 08:44
Here is a current snapshot of the bug.

Project: Python
Category: Distutils
Status: Open
Resolution: None
Bug Group: None
Priority: 7
Summary: define_macros ignored when building Extension

Details: I am working on a setup script for Tkinter, which requires a
-DWITH_APPINIT flag at compile time.  The docs suggest that I should
add the following definition to my Extension constructor call:
    define_macros=[('WITH_APPINIT', None),],

I did this, but it had no effect.  It looks like there is no where
that the define_macros attribute of the Extension object is actually
used.  

I assumed this is a bug and tried to figure out where the macros
definitions ought to be processed.  I'm not familiar with the code, so
I may have put it in the wrong place.  A patch is included below,
which allows _tkinter to build.

Jeremy

*** build_ext.py	Tue Sep 12 20:58:48 2000
--- /home/jeremy/src/python/dist/src/Lib/distutils/command/build_ext.py	Thu Sep  7 11:09:18 2000
***************
*** 401,407 ****
              # any sensible compiler will give precedence to later
              # command line args.  Hence we combine them in order:
              extra_args = ext.extra_compile_args or []
-             macros = ext.define_macros or []
  
              # XXX and if we support CFLAGS, why not CC (compiler
              # executable), CPPFLAGS (pre-processor options), and LDFLAGS
--- 401,406 ----
***************
*** 410,419 ****
  
              if os.environ.has_key('CFLAGS'):
                  extra_args.extend(string.split(os.environ['CFLAGS']))
! 
              objects = self.compiler.compile (sources,
                                               output_dir=self.build_temp,
!                                              macros=macros,
                                               include_dirs=ext.include_dirs,
                                               debug=self.debug,
                                               extra_postargs=extra_args)
--- 409,418 ----
  
              if os.environ.has_key('CFLAGS'):
                  extra_args.extend(string.split(os.environ['CFLAGS']))
!                 
              objects = self.compiler.compile (sources,
                                               output_dir=self.build_temp,
!                                              #macros=macros,
                                               include_dirs=ext.include_dirs,
                                               debug=self.debug,
                                               extra_postargs=extra_args)


For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=114439&group_id=5470