diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2017-11-09 19:23:29 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2017-11-09 19:23:29 -0500 |
commit | 0830232c2c700f09bbd39b8cddc2a0828399e7e8 (patch) | |
tree | 7bb5858a3a8f13bc67436178befc64c12e1c5066 /setuptools/command/bdist_egg.py | |
parent | ee33fa23dcdb7f9a0e89e2df3a50706b75678a36 (diff) | |
download | external_python_setuptools-0830232c2c700f09bbd39b8cddc2a0828399e7e8.tar.gz external_python_setuptools-0830232c2c700f09bbd39b8cddc2a0828399e7e8.tar.bz2 external_python_setuptools-0830232c2c700f09bbd39b8cddc2a0828399e7e8.zip |
Unconditionally rename __pycache__ files if they exist.
Diffstat (limited to 'setuptools/command/bdist_egg.py')
-rw-r--r-- | setuptools/command/bdist_egg.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index 5bfc7ba2..f52c40d1 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -239,7 +239,6 @@ class bdist_egg(Command): def zap_pyfiles(self): log.info("Removing .py files from temporary directory") - py3 = sys.version_info >= (3, 0) re_pycache_file = re.compile('(.+)\.cpython-3\d(.pyc)$') for base, dirs, files in walk_egg(self.bdist_dir): for name in files: @@ -248,12 +247,12 @@ class bdist_egg(Command): log.debug("Deleting %s", path) os.unlink(path) - if py3 and base.endswith('__pycache__'): + if base.endswith('__pycache__'): path_old = os.path.join(base, name) - + m = re_pycache_file.match(name) path_new = os.path.join(base, os.pardir, m.group(1) + m.group(2)) - log.info("Renaming Python 3 .pyc file from [%s] to [%s]" % (path_old, path_new)) + log.info("Renaming file from [%s] to [%s]" % (path_old, path_new)) if os.path.exists(path_new): os.unlink(path_new) os.rename(path_old, path_new) |