diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-07-15 19:03:39 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-07-15 19:03:39 +0000 |
commit | cec85000de0626c5a3298de9d40f481982251b5a (patch) | |
tree | 294a514a6710404a037fffc8df6aff3aa343db70 /pym/portage_util.py | |
parent | 2fbd0d02be1dd5d8ed007786b52eca1cebe0ec77 (diff) | |
download | portage-cec85000de0626c5a3298de9d40f481982251b5a.tar.gz portage-cec85000de0626c5a3298de9d40f481982251b5a.tar.bz2 portage-cec85000de0626c5a3298de9d40f481982251b5a.zip |
Move normalize_path into portage_util.
svn path=/main/trunk/; revision=3891
Diffstat (limited to 'pym/portage_util.py')
-rw-r--r-- | pym/portage_util.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pym/portage_util.py b/pym/portage_util.py index 79babe05c..0449b614f 100644 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -30,6 +30,13 @@ def writemsg_stdout(mystr,noiselevel=0): """Prints messages stdout based on the noiselimit setting""" writemsg(mystr, noiselevel=noiselevel, fd=sys.stdout) +def normalize_path(mypath): + 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) + def grabfile(myfilename, compat_level=0, recursive=0): """This function grabs the lines in a file, normalizes whitespace and returns lines in a list; if a line begins with a #, it is ignored, as are empty lines""" |