Remove also compiled pyo files for wheel packages. (#5173)

This commit is contained in:
Bastian Venthur 2018-06-21 19:30:20 +02:00 committed by Pradyun Gedam
parent 14fe337bcf
commit 4dee7e9ad2
3 changed files with 9 additions and 4 deletions

1
news/4471.bugfix Normal file
View File

@ -0,0 +1 @@
Remove compiled pyo files for wheel packages.

View File

@ -57,12 +57,12 @@ def _unique(fn):
@_unique
def uninstallation_paths(dist):
"""
Yield all the uninstallation paths for dist based on RECORD-without-.pyc
Yield all the uninstallation paths for dist based on RECORD-without-.py[co]
Yield paths to all the files in RECORD. For each .py file in RECORD, add
the .pyc in the same directory.
the .pyc and .pyo in the same directory.
UninstallPathSet.add() takes care of the __pycache__ .pyc.
UninstallPathSet.add() takes care of the __pycache__ .py[co].
"""
r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD')))
for row in r:
@ -73,6 +73,8 @@ def uninstallation_paths(dist):
base = fn[:-3]
path = os.path.join(dn, base + '.pyc')
yield path
path = os.path.join(dn, base + '.pyo')
yield path
def compact(paths):

View File

@ -32,9 +32,11 @@ def test_uninstallation_paths():
expected = ['file.py',
'file.pyc',
'file.pyo',
'file.so',
'nopyc.py',
'nopyc.pyc']
'nopyc.pyc',
'nopyc.pyo']
assert paths == expected