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 | f883f07459037dc960b7f319d4f265671a0fec88 (patch) | |
tree | 824d9ac609a98d70e2cbefd0e7368abbea64f91d /setuptools/command/install_lib.py | |
parent | d42aea783a347d431eaf293250bab60c05b4c779 (diff) | |
parent | c3f53e3ab73e269a25f0638aa137b2a7ea9ed5e6 (diff) | |
download | external_python_setuptools-f883f07459037dc960b7f319d4f265671a0fec88.tar.gz external_python_setuptools-f883f07459037dc960b7f319d4f265671a0fec88.tar.bz2 external_python_setuptools-f883f07459037dc960b7f319d4f265671a0fec88.zip |
Merged in mesocody/setuptools (pull request #72)
Fix exclude list on python 3.2+
Diffstat (limited to 'setuptools/command/install_lib.py')
-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 |