diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2014-09-26 09:53:00 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-09-26 09:53:00 -0400 |
commit | 3c293d068d446d37f937fbb09ce01265c35eefc0 (patch) | |
tree | 205cbf62aac8351f7573c68c64a6f61d506e52c8 | |
parent | 19708e2c4e944e0ec5843437744b8f23f235a026 (diff) | |
parent | cc9b98c2a39cf0dc53faa650bbd44d572e00c6e4 (diff) | |
download | python-setuptools-bitbucket-3c293d068d446d37f937fbb09ce01265c35eefc0.tar.gz |
Merged in mesocody/setuptools (pull request #72)
Fix exclude list on python 3.2+
-rw-r--r-- | setuptools/command/install_lib.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index d7e117f0..7692e0f3 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -1,6 +1,5 @@ import distutils.command.install_lib as orig -import os - +import os, imp class install_lib(orig.install_lib): """Don't add compiled flags to filenames of non-Python files""" @@ -17,12 +16,24 @@ class install_lib(orig.install_lib): nsp = self.distribution.namespace_packages svem = (nsp and self.get_finalized_command('install') .single_version_externally_managed) + exclude_names = ['__init__.py', '__init__.pyc', '__init__.pyo'] + if hasattr(imp, 'get_tag') : + exclude_names.extend(( + os.path.join( + '__pycache__', + '__init__.' + imp.get_tag() + '.pyc' + ), + os.path.join( + '__pycache__', + '__init__.' + imp.get_tag() + '.pyo' + ), + )) if svem: for pkg in nsp: parts = pkg.split('.') while parts: pkgdir = os.path.join(self.install_dir, *parts) - for f in '__init__.py', '__init__.pyc', '__init__.pyo': + for f in exclude_names : exclude[os.path.join(pkgdir, f)] = 1 parts.pop() return exclude |