aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRick Liu <rickliu@fortinet.com>2016-04-15 12:19:52 -0700
committerRick Liu <rickliu@fortinet.com>2016-04-15 12:26:55 -0700
commit18b7ab638a52b1dc2899f2e32b33f41d931ce2f4 (patch)
tree48f42020ff5211c8cc4c9e75db88b87aca426d22
parent4950c05901da4382741cc8ce22a12da50436e2cf (diff)
downloadexternal_python_setuptools-18b7ab638a52b1dc2899f2e32b33f41d931ce2f4.tar.gz
external_python_setuptools-18b7ab638a52b1dc2899f2e32b33f41d931ce2f4.tar.bz2
external_python_setuptools-18b7ab638a52b1dc2899f2e32b33f41d931ce2f4.zip
Handle not-zip-safe egg (folder) deletion in rotate command
-rwxr-xr-xsetuptools/command/rotate.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/setuptools/command/rotate.py b/setuptools/command/rotate.py
index 804f962a..b89353f5 100755
--- a/setuptools/command/rotate.py
+++ b/setuptools/command/rotate.py
@@ -2,6 +2,7 @@ from distutils.util import convert_path
from distutils import log
from distutils.errors import DistutilsOptionError
import os
+import shutil
from setuptools.extern import six
@@ -59,4 +60,7 @@ class rotate(Command):
for (t, f) in files:
log.info("Deleting %s", f)
if not self.dry_run:
- os.unlink(f)
+ if os.path.isdir(f):
+ shutil.rmtree(f)
+ else:
+ os.unlink(f)