Commit 4d16e0ac authored by Greg Ward's avatar Greg Ward

Added 'get_outputs()' in prepartion for the 'bdist' command.

Changed signature of 'build_extensions()': no longer takes the extension
  list, but uses 'self.extensions' (just like 'get_outputs()' has to)
Moved call to 'check_extensions_list()' from 'run()' to 'build_extensions()',
  again for consistency with 'get_outputs()'.
parent 8b2e95ed
...@@ -141,9 +141,6 @@ class build_ext (Command): ...@@ -141,9 +141,6 @@ class build_ext (Command):
if not self.extensions: if not self.extensions:
return return
# First, sanity-check the 'self.extensions' list
self.check_extensions_list (self.extensions)
# Simplify the following logic (eg. don't have to worry about # Simplify the following logic (eg. don't have to worry about
# appending to None) # appending to None)
if self.libraries is None: if self.libraries is None:
...@@ -156,7 +153,7 @@ class build_ext (Command): ...@@ -156,7 +153,7 @@ class build_ext (Command):
# If we were asked to build any C/C++ libraries, make sure that the # If we were asked to build any C/C++ libraries, make sure that the
# directory where we put them is in the library search path for # directory where we put them is in the library search path for
# linking extensions. # linking extensions.
if self.distribution.libraries: if self.distribution.has_c_libraries():
build_clib = self.find_peer ('build_clib') build_clib = self.find_peer ('build_clib')
self.libraries.extend (build_clib.get_library_names() or []) self.libraries.extend (build_clib.get_library_names() or [])
self.library_dirs.append (build_clib.build_clib) self.library_dirs.append (build_clib.build_clib)
...@@ -190,8 +187,9 @@ class build_ext (Command): ...@@ -190,8 +187,9 @@ class build_ext (Command):
self.compiler.set_link_objects (self.link_objects) self.compiler.set_link_objects (self.link_objects)
# Now actually compile and link everything. # Now actually compile and link everything.
self.build_extensions (self.extensions) self.build_extensions ()
# run ()
def check_extensions_list (self, extensions): def check_extensions_list (self, extensions):
...@@ -239,9 +237,32 @@ class build_ext (Command): ...@@ -239,9 +237,32 @@ class build_ext (Command):
return filenames return filenames
def get_outputs (self):
# Sanity check the 'extensions' list -- can't assume this is being
# done in the same run as a 'build_extensions()' call (in fact, we
# can probably assume that it *isn't*!).
self.check_extensions_list (self.extensions)
# And build the list of output (built) filenames. Note that this
# ignores the 'inplace' flag, and assumes everything goes in the
# "build" tree.
outputs = []
for (extension_name, build_info) in self.extensions:
fullname = self.get_ext_fullname (extension_name)
outputs.append (os.path.join (self.build_lib,
self.get_ext_filename(fullname)))
return outputs
# get_outputs ()
def build_extensions (self, extensions): def build_extensions (self, extensions):
for (extension_name, build_info) in extensions: # First, sanity-check the 'extensions' list
self.check_extensions_list (self.extensions)
for (extension_name, build_info) in self.extensions:
sources = build_info.get ('sources') sources = build_info.get ('sources')
if sources is None or type (sources) not in (ListType, TupleType): if sources is None or type (sources) not in (ListType, TupleType):
raise DistutilsValueError, \ raise DistutilsValueError, \
...@@ -290,7 +311,7 @@ class build_ext (Command): ...@@ -290,7 +311,7 @@ class build_ext (Command):
else: else:
modname = string.split (extension_name, '.')[-1] modname = string.split (extension_name, '.')[-1]
extra_args.append('/export:init%s'%modname) extra_args.append('/export:init%s'%modname)
# end if MSVC # if MSVC
fullname = self.get_ext_fullname (extension_name) fullname = self.get_ext_fullname (extension_name)
if self.inplace: if self.inplace:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment