Skip to content

Commit 1b5c8f4

Browse files
committed
WPPM: removing __pycache__ directories when uninstalling packages
1 parent fce041b commit 1b5c8f4

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

winpython/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
OTHER DEALINGS IN THE SOFTWARE.
2828
"""
2929

30-
__version__ = '0.13'
30+
__version__ = '0.14'
3131
__license__ = __doc__
3232
__project_url__ = 'http://code.google.com/p/winpython'
3333
__forum_url__ = 'http://groups.google.com/group/winpython'

winpython/wppm.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,15 @@ def uninstall(self, package):
404404
elif osp.isdir(path):
405405
if self.verbose:
406406
print("rmdir: %s" % fname)
407+
pycache = osp.join(path, '__pycache__')
408+
if osp.exists(pycache):
409+
try:
410+
shutil.rmtree(pycache, onerror=utils.onerror)
411+
if self.verbose:
412+
print("rmtree: %s" % pycache)
413+
except WindowsError:
414+
print("Directory %s could not be removed"\
415+
% pycache, file=sys.stderr)
407416
try:
408417
os.rmdir(path)
409418
except OSError:

0 commit comments

Comments
 (0)