[Python-checkins] python/dist/src/Lib/distutils/command build_ext.py, 1.96, 1.97

anthonybaxter at users.sourceforge.net anthonybaxter at users.sourceforge.net
Thu Oct 14 12:02:11 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/distutils/command
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4862/Lib/distutils/command
Modified Files:
	build_ext.py 
Log Message:
Patch 1046644 - improved distutils support for SWIG.
Index: build_ext.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_ext.py,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- build_ext.py	18 Jul 2004 06:14:43 -0000	1.96
+++ build_ext.py	14 Oct 2004 10:02:08 -0000	1.97
@@ -81,6 +81,10 @@
 "specify the compiler type"),
 ('swig-cpp', None,
 "make SWIG create C++ files (default is C)"),
+ ('swig-opts=', None,
+ "list of SWIG command line options"),
+ ('swig=', None,
+ "path to the SWIG executable"),
 ]
 
 boolean_options = ['inplace', 'debug', 'force', 'swig-cpp']
@@ -107,8 +111,9 @@
 self.debug = None
 self.force = None
 self.compiler = None
+ self.swig = None
 self.swig_cpp = None
-
+ self.swig_opts = None
 
 def finalize_options (self):
 from distutils import sysconfig
@@ -205,6 +210,11 @@
 if self.undef:
 self.undef = string.split(self.undef, ',')
 
+ if self.swig_opts is None:
+ self.swig_opts = []
+ else:
+ self.swig_opts = self.swig_opts.split(' ')
+
 # finalize_options ()
 
 
@@ -429,7 +439,7 @@
 # First, scan the sources for SWIG definition files (.i), run
 # SWIG on 'em to create .c files, and modify the sources list
 # accordingly.
- sources = self.swig_sources(sources)
+ sources = self.swig_sources(sources, ext)
 
 # Next, compile the source code to object files.
 
@@ -492,7 +502,7 @@
 target_lang=language)
 
 
- def swig_sources (self, sources):
+ def swig_sources (self, sources, extension):
 
 """Walk the list of source files in 'sources', looking for SWIG
 interface (.i) files. Run SWIG on all that are found, and
@@ -510,6 +520,9 @@
 # the temp dir.
 
 if self.swig_cpp:
+ log.warn("--swig-cpp is deprecated - use --swig-opts=-c++")
+
+ if self.swig_cpp or ('-c++' in self.swig_opts):
 target_ext = '.cpp'
 else:
 target_ext = '.c'
@@ -526,11 +539,17 @@
 if not swig_sources:
 return new_sources
 
- swig = self.find_swig()
+ swig = self.swig or self.find_swig()
 swig_cmd = [swig, "-python"]
+ swig_cmd.extend(self.swig_opts)
 if self.swig_cpp:
 swig_cmd.append("-c++")
 
+ # Do not override commandline arguments
+ if not self.swig_opts:
+ for o in extension.swig_opts:
+ swig_cmd.append(o)
+
 for source in swig_sources:
 target = swig_targets[source]
 log.info("swigging %s to %s", source, target)


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /