aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2006-01-13 23:52:42 +0000
committerPJ Eby <distutils-sig@python.org>2006-01-13 23:52:42 +0000
commitcca060c2d83301f1aae9fc4be26612a75a1c38c3 (patch)
tree5c1ef7ecd3e71819d75f16cde77b3ac7a859a3bf /setuptools
parent40c0f5e609fb3e074be524da077fc4c85c282a05 (diff)
downloadexternal_python_setuptools-cca060c2d83301f1aae9fc4be26612a75a1c38c3.tar.gz
external_python_setuptools-cca060c2d83301f1aae9fc4be26612a75a1c38c3.tar.bz2
external_python_setuptools-cca060c2d83301f1aae9fc4be26612a75a1c38c3.zip
Ensure installed stubs get compiled, even if there are no "pure" modules
present. Also, don't bother compiling the stub prior to installation. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4042037
Diffstat (limited to 'setuptools')
-rw-r--r--setuptools/command/build_ext.py14
-rw-r--r--setuptools/command/install_lib.py9
2 files changed, 16 insertions, 7 deletions
diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index 71d05d91..74edc869 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -67,7 +67,7 @@ class build_ext(_build_ext):
dry_run=self.dry_run
)
if ext._needs_stub:
- self.write_stub(package_dir, ext, False)
+ self.write_stub(package_dir or os.curdir, ext)
if _build_ext is not _du_build_ext:
@@ -101,7 +101,7 @@ class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_options(self)
self.extensions = self.extensions or []
- self.check_extensions_list()
+ self.check_extensions_list(self.extensions)
self.shlibs = [ext for ext in self.extensions
if isinstance(ext,Library)]
if self.shlibs:
@@ -169,12 +169,14 @@ class build_ext(_build_ext):
self.compiler = self.shlib_compiler
_build_ext.build_extension(self,ext)
if ext._needs_stub:
- self.write_stub(self.build_lib, ext)
+ self.write_stub(
+ self.get_finalized_command('build_py').build_lib, ext
+ )
finally:
self.compiler = _compiler
- def write_stub(self, output_dir, ext, compile=True):
- log.info("writing stub loader for %s",ext._full_name)
+ def write_stub(self, output_dir, ext):
+ log.info("writing stub loader for %s to %s",ext._full_name, output_dir)
stub_file = os.path.join(output_dir, *ext._full_name.split('.'))+'.py'
if not self.dry_run:
f = open(stub_file,'w')
@@ -200,8 +202,6 @@ class build_ext(_build_ext):
"" # terminal \n
]))
f.close()
- if compile:
- self.get_finalized_command('build_py').byte_compile(stub_file)
def links_to_dynamic(self, ext):
"""Return true if 'ext' links to a dynamic lib in the same package"""
diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py
index 63e2468c..75ff54b1 100644
--- a/setuptools/command/install_lib.py
+++ b/setuptools/command/install_lib.py
@@ -14,3 +14,12 @@ class install_lib(_install_lib):
bytecode_files.append(py_file + "o")
return bytecode_files
+
+
+ def run(self):
+ self.build()
+ outfiles = self.install()
+ if outfiles is not None:
+ # always compile, in case we have any extension stubs to deal with
+ self.byte_compile(outfiles)
+