Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Refs #640. Normalize a relative egg-link path before checking to see if it matches #641

wants to merge 1 commit into from

5 participants


No description provided.


This pull request passes (merged a87f259 into 1749343).


This patch looks great. Do you think you might be able to contribute a test or two to "tests/"?


@mcdonc Yeah I can. Given that this patch depends on behavior of virtualenv after a package has already been installed, is it sufficient enough to just recreate the situation manually (i.e. create an egg-link file that is relative), or do you suggest something else?


@kylegibson The pip tests already create a scratch virtualenv for each test, so you do have the option of actually calling virtualenv --relocatable in the test (there is some code that reuses virtualenvs between tests to speed things up, so you'll want to make sure this one doesn't get reused, I'd have to dig into to recall exactly how that's done). You can either do that or try to accurately reconstruct its effects, whichever you find more straightforward.


This needed tests which were never added and now it doesn't merge cleanly. I'd say close it.


Unless @kylegibson is interested in updating this to merge cleanly and add tests,
I'd say this can be closed to make the # of outstanding PRs more manageable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 16, 2012
  1. @kylegibson
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 4 deletions.
  1. +14 −4 pip/
18 pip/
@@ -469,15 +469,25 @@ def uninstall(self, auto_confirm=False):
paths_to_remove.add_pth(easy_install_pth, './' + easy_install_egg)
elif develop_egg_link:
- # develop egg
+ # read contents of egg link file
fh = open(develop_egg_link, 'r')
- link_pointer = os.path.normcase(fh.readline().strip())
+ path_in_egg_link = os.path.normcase(fh.readline().strip())
+ develop_egg_link_dirname = os.path.dirname(develop_egg_link)
+ link_pointer = path_in_egg_link
+ if not link_pointer.startswith('/'):
+ # properly handle relative egg link paths
+ link_pointer = os.path.abspath(
+ os.path.join(develop_egg_link_dirname, link_pointer)
+ )
assert (link_pointer == dist.location), 'Egg-link %s does not match installed location of %s (at %s)' % (link_pointer,, dist.location)
- easy_install_pth = os.path.join(os.path.dirname(develop_egg_link),
+ easy_install_pth = os.path.join(develop_egg_link_dirname,
- paths_to_remove.add_pth(easy_install_pth, dist.location)
+ # If the egg link was relative, it will be relative in the
+ # easy_install file as well.
+ paths_to_remove.add_pth(easy_install_pth, path_in_egg_link)
# find distutils scripts= scripts
if dist.has_metadata('scripts') and dist.metadata_isdir('scripts'):
Something went wrong with that request. Please try again.