changeset 1107:8e15eeb3cfc3

setup: cleaning also handles egg filenames not containing the python version
author souliane <souliane@mailoo.org>
date Wed, 13 Aug 2014 18:39:46 +0200 (2014-08-13)
parents e2e1e27a3680
children 6bdcaeafca11
files setup.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Wed Aug 13 14:48:49 2014 +0200
+++ b/setup.py	Wed Aug 13 18:39:46 2014 +0200
@@ -128,10 +128,13 @@
             message = "Cleaning previous installation directories"
         if to_remove is None:
             to_remove = []
-        to_remove.extend([os.path.join(self.install_lib, NAME),
-                          os.path.join(self.install_data, 'share', 'doc', NAME),
-                          os.path.join(self.install_lib, "%s-py%s.egg-info" % (self.config_vars['dist_fullname'], self.config_vars['py_version_short'])),
-                          ])
+        for path in [os.path.join(self.install_lib, NAME),
+                     os.path.join(self.install_data, 'share', 'doc', NAME),
+                     os.path.join(self.install_lib, "%s.egg-info" % self.config_vars['dist_fullname']),
+                     os.path.join(self.install_lib, "%s-py%s.egg-info" % (self.config_vars['dist_fullname'], self.config_vars['py_version_short'])),
+                     ]:
+            if os.path.isdir(path):
+                to_remove.append(path)
         for source, dest in self.sh_script_links:
             if os.path.islink(dest):
                 to_remove.append(dest)