summaryrefslogtreecommitdiff
path: root/setuptools/command/bdist_egg.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2017-11-09 19:30:56 -0500
committerJason R. Coombs <jaraco@jaraco.com>2017-11-09 19:30:56 -0500
commit9a79433af7e66ee5c1f721a1803dad4873666e62 (patch)
treef3d42b18aa9f76c7f9e11d9d9537c6b0ec5cc8cc /setuptools/command/bdist_egg.py
parent0830232c2c700f09bbd39b8cddc2a0828399e7e8 (diff)
downloadpython-setuptools-git-9a79433af7e66ee5c1f721a1803dad4873666e62.tar.gz
Use named groups in the pattern
Diffstat (limited to 'setuptools/command/bdist_egg.py')
-rw-r--r--setuptools/command/bdist_egg.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py
index f52c40d1..14dd97d3 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")
- re_pycache_file = re.compile('(.+)\.cpython-3\d(.pyc)$')
for base, dirs, files in walk_egg(self.bdist_dir):
for name in files:
if name.endswith('.py'):
@@ -250,8 +249,9 @@ class bdist_egg(Command):
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))
+ pattern = r'(?P<name>.+)\.(?P<magic>[^.]+)\.pyc'
+ m = re.match(pattern, name)
+ path_new = os.path.join(base, os.pardir, m.group('name') + '.pyc')
log.info("Renaming file from [%s] to [%s]" % (path_old, path_new))
if os.path.exists(path_new):
os.unlink(path_new)