Commits

Carl Meyer  committed e79a555

catch easy_installed script wrappers

  • Participants
  • Parent commits 5024c19
  • Branches trunk

Comments (0)

Files changed (2)

 # FIXME doesn't account for venv linked to global site-packages
 if sys.platform == 'win32':
     lib_py = os.path.join(sys.prefix, 'Lib')
+    bin_py = os.path.join(sys.prefix, 'Scripts')
+    # buildout uses 'bin' on Windows too?
+    if not os.path.exists(bin_py):
+        bin_py = os.path.join(sys.prefix, 'bin')
 else:
     lib_py = os.path.join(sys.prefix, 'lib', 'python%s' % sys.version[:3])
+    bin_py = os.path.join(sys.prefix, 'bin')
     
 pypi_url = "http://pypi.python.org/simple"
 
                                             'easy-install.pth')
             paths_to_remove.add_pth(easy_install_pth, dist.location)
 
+        # get scripts from metadata FIXME there seems to be no way to
+        # get info about installed scripts from a
+        # develop-install. python setup.py develop --record in
+        # install_editable seemingly ought to work, but does not
+        if dist.has_metadata('scripts') and dist.metadata_isdir('scripts'):
+            for script in dist.metadata_listdir('scripts'):
+                paths_to_remove.add(os.path.join(bin_py, script))
+
         paths_to_remove.remove(auto_confirm)
         paths_to_remove.commit()
 
         self._moved_paths = []
 
     def add(self, path):
+        if not os.path.exists(path):
+            return
         stripped = strip_prefix(os.path.normcase(path), self.prefix)
         if stripped:
             self.paths.add(stripped)

File tests/test_uninstall.txt

     >>> diff_states(result.files_before, result2.files_after, ignore=['build']).values()
     [{}, {}, {}]
 
-Uninstall an easy_installed package::
+Uninstall an easy_installed package with scripts::
 
     >>> reset_env()
     >>> env = get_env()
-    >>> result = env.run(join(env.base_path, 'bin', 'easy_install'), 'INITools')
-    >>> assert('INITools' in result.files_updated[easy_install_pth].bytes), result.files_after[easy-install_pth].bytes
-    >>> result2 = run_pip('uninstall', 'INITools', '-y', expect_error=True)
+    >>> result = env.run(join(env.base_path, 'bin', 'easy_install'), 'Markdown')
+    >>> assert('Markdown' in result.files_updated[easy_install_pth].bytes), result.files_after[easy-install_pth].bytes
+    >>> result2 = run_pip('uninstall', 'markdown', '-y', expect_error=True)
     >>> diff_states(result.files_before, result2.files_after, ignore=['build']).values()
     [{}, {}, {}]