summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>1999-09-13 13:55:34 (GMT)
committerGreg Ward <gward@python.net>1999-09-13 13:55:34 (GMT)
commit609a5c818d1b13302594870e05e8e28133613147 (patch)
tree6a3fa3efee77a029f9855f926335611caf3acd2b
parent68bdf3eeb7497757f9bdf46ba6509d440330db4b (diff)
downloadcpython-609a5c818d1b13302594870e05e8e28133613147.zip
cpython-609a5c818d1b13302594870e05e8e28133613147.tar.gz
cpython-609a5c818d1b13302594870e05e8e28133613147.tar.bz2
Added support for 'package' option, including where to link the
actual extension module to.
-rw-r--r--Lib/distutils/command/build_ext.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
index a3982c1..2991581 100644
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -63,6 +63,8 @@ class BuildExt (Command):
def set_default_options (self):
self.extensions = None
self.dir = None
+ self.package = None
+
self.include_dirs = None
self.define = None
self.undef = None
@@ -74,6 +76,9 @@ class BuildExt (Command):
def set_final_options (self):
self.set_undefined_options ('build', ('platdir', 'dir'))
+ if self.package is None:
+ self.package = ''
+
# Make sure Python's include directories (for Python.h, config.h,
# etc.) are in the include search path. We have to roll our own
# "exec include dir", because the Makefile parsed by sysconfig
@@ -92,12 +97,6 @@ class BuildExt (Command):
self.set_final_options ()
- # XXX we should care about the package we compile extensions
- # into!
-
- #(extensions, package) = \
- # self.distribution.get_options ('ext_modules', 'package')
-
# 'self.extensions', as supplied by setup.py, is a list of 2-tuples.
# Each tuple is simple:
# (ext_name, build_info)
@@ -187,8 +186,12 @@ class BuildExt (Command):
libraries = build_info.get ('libraries')
library_dirs = build_info.get ('library_dirs')
ext_filename = self.extension_filename (extension_name)
- self.compiler.link_shared_object (objects, ext_filename,
- libraries, library_dirs, build_info)
+ dest = os.path.dirname (
+ os.path.join (self.dir, self.package, ext_filename))
+ self.mkpath (dest)
+ self.compiler.link_shared_object (objects, ext_filename, dest,
+ libraries, library_dirs,
+ build_info=build_info) # XXX hack!
# build_extensions ()