From: Zac Medico Date: Sat, 15 Jul 2006 18:34:08 +0000 (-0000) Subject: Simplify portage.normalize_path() logic. X-Git-Tag: v2.1.1~224 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=93bdc0af136671736a6b68083efed7a0d2879739;p=portage.git Simplify portage.normalize_path() logic. svn path=/main/trunk/; revision=3889 --- diff --git a/pym/portage.py b/pym/portage.py index 00f6a427f..a50b573da 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -188,11 +188,11 @@ def prefix_array(array,prefix,doblanks=1): return newarray def normalize_path(mypath): - newpath = os.path.normpath(mypath) - if len(newpath) > 1: - if newpath[:2] == "//": - newpath = newpath[1:] - return newpath + if mypath.startswith(os.path.sep): + # posixpath.normpath collapses 3 or more leading slashes to just 1. + return os.path.normpath(2*os.path.sep + mypath) + else: + return os.path.normpath(mypath) dircache = {} cacheHit=0