mirror of https://github.com/pypa/pip
Remove also compiled pyo files for wheel packages. (#5173)
This commit is contained in:
parent
14fe337bcf
commit
4dee7e9ad2
|
@ -0,0 +1 @@
|
|||
Remove compiled pyo files for wheel packages.
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue