diff options
author | PJ Eby <distutils-sig@python.org> | 2006-01-13 22:32:57 +0000 |
---|---|---|
committer | PJ Eby <distutils-sig@python.org> | 2006-01-13 22:32:57 +0000 |
commit | f41432389955d4e1835cef866d23b15ab6edf51a (patch) | |
tree | e56c15af754252fdc6fadd348ea0dd43a8451ec1 | |
parent | eb8c892b98be8410b2ec084ed6d7a33ea164bf4b (diff) | |
download | external_python_setuptools-f41432389955d4e1835cef866d23b15ab6edf51a.tar.gz external_python_setuptools-f41432389955d4e1835cef866d23b15ab6edf51a.tar.bz2 external_python_setuptools-f41432389955d4e1835cef866d23b15ab6edf51a.zip |
Don't write .py stubs except for actual extensions that don't already
have them.
--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4042034
-rw-r--r-- | setuptools/command/bdist_egg.py | 38 | ||||
-rw-r--r-- | setuptools/command/build_ext.py | 14 |
2 files changed, 26 insertions, 26 deletions
diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index 16d2486f..68b1ba67 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -10,6 +10,7 @@ from distutils.sysconfig import get_python_version, get_python_lib from distutils import log from pkg_resources import get_platform, Distribution from types import CodeType +from setuptools.extension import Library def write_stub(resource, pyfile): f = open(pyfile,'w') @@ -38,7 +39,6 @@ NS_PKG_STUB = '__import__("pkg_resources").declare_namespace(__name__)' - class bdist_egg(Command): description = "create an \"egg\" distribution" @@ -174,7 +174,7 @@ class bdist_egg(Command): cmd = self.call_command('install_lib', warn_dir=0) instcmd.root = old_root - ext_outputs = self.get_ext_outputs() + all_outputs, ext_outputs = self.get_ext_outputs() self.stubs = [] to_compile = [] for (p,ext_name) in enumerate(ext_outputs): @@ -204,11 +204,11 @@ class bdist_egg(Command): self.call_command('install_scripts', install_dir=script_dir) native_libs = os.path.join(self.egg_info,"native_libs.txt") - if ext_outputs: + if all_outputs: log.info("writing %s" % native_libs) if not self.dry_run: libs_file = open(native_libs, 'wt') - libs_file.write('\n'.join(ext_outputs)) + libs_file.write('\n'.join(all_outputs)) libs_file.write('\n') libs_file.close() elif os.path.isfile(native_libs): @@ -288,28 +288,28 @@ class bdist_egg(Command): def get_ext_outputs(self): """Get a list of relative paths to C extensions in the output distro""" - outputs = [] + all_outputs = [] + ext_outputs = [] + paths = {self.bdist_dir:''} for base, dirs, files in os.walk(self.bdist_dir): for filename in files: if os.path.splitext(filename)[1].lower() in NATIVE_EXTENSIONS: - outputs.append(paths[base]+filename) + all_outputs.append(paths[base]+filename) for filename in dirs: paths[os.path.join(base,filename)] = paths[base]+filename+'/' - - if not self.distribution.has_ext_modules(): - return outputs - - build_cmd = self.get_finalized_command('build_ext') - prefix_len = len(build_cmd.build_lib) + len(os.sep) - - for filename in build_cmd.get_outputs(): - if os.path.splitext(filename)[1].lower() not in NATIVE_EXTENSIONS: - # only add files w/unrecognized extensions, since the - # recognized ones will already be in the list - outputs.append(filename[prefix_len:]) - return outputs + if self.distribution.has_ext_modules(): + build_cmd = self.get_finalized_command('build_ext') + for ext in build_cmd.extensions: + if isinstance(ext,Library): + continue + fullname = build_cmd.get_ext_fullname(ext.name) + filename = build_cmd.get_ext_filename(fullname) + if not os.path.basename(filename).startswith('dl-'): + ext_outputs.append(filename) + + return all_outputs, ext_outputs NATIVE_EXTENSIONS = dict.fromkeys('.dll .so .dylib .pyd'.split()) diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py index 6d5fb124..7f110436 100644 --- a/setuptools/command/build_ext.py +++ b/setuptools/command/build_ext.py @@ -165,12 +165,12 @@ class build_ext(_build_ext): def build_extension(self, ext): _compiler = self.compiler _rpath = ext.runtime_library_dirs - _ldirs = library_dirs + _ldirs = ext.library_dirs try: if isinstance(ext,Library): self.compiler = self.shlib_compiler - if have_rtld and self.links_to_dynamic(ext): - ext.runtime_library_dirs = _rpath + [os.curdir] + if self.links_to_dynamic(ext): + if have_rtld: ext.runtime_library_dirs = _rpath + [os.curdir] ext.library_dirs = _ldirs + [ os.path.dirname( os.path.join(self.build_lib, @@ -196,12 +196,12 @@ class build_ext(_build_ext): libnames = dict.fromkeys( [self.get_ext_fullname(lib.name) for lib in self.shlibs] ) - if not libnames: - return False pkg = '.'.join(self.get_ext_fullname(ext.name).split('.')[:-1]) + if pkg: pkg+='.' for libname in ext.libraries: - if ('%s.%s' % (pkg,libname)) in libnames: - return True + if pkg+libname in libnames: return True + return False + if have_rtld or os.name=='nt': # Build shared libraries |