diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-05-10 10:34:01 (GMT) |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-05-10 10:34:01 (GMT) |
commit | 06fbee16dc5c159d8c607c007f2c0de3257c6433 (patch) | |
tree | 2d41b17b40be0deb21335626059659a6936715fb /Lib/distutils/command | |
parent | 54d9d078064d1406ae7e6beb3c12865b6b78d9ff (diff) | |
download | cpython-06fbee16dc5c159d8c607c007f2c0de3257c6433.zip cpython-06fbee16dc5c159d8c607c007f2c0de3257c6433.tar.gz cpython-06fbee16dc5c159d8c607c007f2c0de3257c6433.tar.bz2 |
Merged revisions 72531 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72531 | tarek.ziade | 2009-05-10 12:12:08 +0200 (Sun, 10 May 2009) | 1 line
fixed #5984 and improved test coverage
........
Diffstat (limited to 'Lib/distutils/command')
-rw-r--r-- | Lib/distutils/command/build_ext.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index ade95be..d3668e9 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -329,7 +329,7 @@ class build_ext(Command): self.compiler.set_include_dirs(self.include_dirs) if self.define is not None: # 'define' option is a list of (name,value) tuples - for (name,value) in self.define: + for (name, value) in self.define: self.compiler.define_macro(name, value) if self.undef is not None: for macro in self.undef: @@ -365,22 +365,24 @@ class build_ext(Command): continue # OK! (assume type-checking done # by Extension constructor) - (ext_name, build_info) = ext - log.warn("old-style (ext_name, build_info) tuple found in " - "ext_modules for extension '%s'" - "-- please convert to Extension instance" % ext_name) - if not isinstance(ext, tuple) and len(ext) != 2: + if not isinstance(ext, tuple) or len(ext) != 2: raise DistutilsSetupError( "each element of 'ext_modules' option must be an " "Extension instance or 2-tuple") + ext_name, build_info = ext + + log.warn(("old-style (ext_name, build_info) tuple found in " + "ext_modules for extension '%s'" + "-- please convert to Extension instance" % ext_name)) + if not (isinstance(ext_name, str) and extension_name_re.match(ext_name)): raise DistutilsSetupError( "first element of each tuple in 'ext_modules' " "must be the extension name (a string)") - if not instance(build_info, DictionaryType): + if not isinstance(build_info, dict): raise DistutilsSetupError( "second element of each tuple in 'ext_modules' " "must be a dictionary (build info)") @@ -391,11 +393,8 @@ class build_ext(Command): # Easy stuff: one-to-one mapping from dict elements to # instance attributes. - for key in ('include_dirs', - 'library_dirs', - 'libraries', - 'extra_objects', - 'extra_compile_args', + for key in ('include_dirs', 'library_dirs', 'libraries', + 'extra_objects', 'extra_compile_args', 'extra_link_args'): val = build_info.get(key) if val is not None: |