Because of my setup, one of my repos often changes location due to a symlink switch...
authorFabian Groffen <grobian@gentoo.org>
Sat, 9 Jan 2010 15:29:51 +0000 (15:29 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sat, 9 Jan 2010 15:29:51 +0000 (15:29 -0000)
svn path=/main/branches/prefix/; revision=15184

pym/_emerge/RepoDisplay.py

index 67bf62672a4b98679bf5b781cb4add54a9c73dc7..17df5f5fd8aab85daf6ac0081bd586cae47df815 100644 (file)
@@ -32,7 +32,18 @@ class RepoDisplay(object):
        def repoStr(self, repo_path_real):
                real_index = -1
                if repo_path_real:
-                       real_index = self._repo_paths_real.index(repo_path_real)
+                       try:
+                               real_index = self._repo_paths_real.index(repo_path_real)
+                       except ValueError:
+                               # This typically happens when a repo is on a symlink and
+                               # the symlink is switched to a different target during
+                               # the dep-calculations, causing the realpath here to
+                               # resolve in a different location than the one
+                               # formally known.  Since this should be pretty rare
+                               # (although I hit it often enough to fix it), making
+                               # this case equal to an "unknown repo" should be
+                               # sufficient to cover the case.
+                               real_index = -1
                if real_index == -1:
                        s = "?"
                        self._unknown_repo = True