changeset 501:b483f1c88b7c

setup: cleaning also handles egg filenames not containing the python version
author souliane <souliane@mailoo.org>
date Wed, 13 Aug 2014 18:36:57 +0200
parents 67a4e8383b70
children 4aa627b059df
files setup.py
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Wed Aug 13 14:09:09 2014 +0200
+++ b/setup.py	Wed Aug 13 18:36:57 2014 +0200
@@ -179,11 +179,14 @@
             message = "Cleaning previous installation directories"
         if to_remove is None:
             to_remove = []
-        to_remove.extend([os.path.join(self.install_lib, NAME),
-                          self.install_data_dir,
-                          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),
+                     self.install_data_dir,
+                     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)