summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-06-28 19:36:52 +0000
committerZac Medico <zmedico@gentoo.org>2006-06-28 19:36:52 +0000
commit2d7ef0838f59e03cc27ef0d8576538591704781e (patch)
tree06ca6a05f11e1e816f95164642ae6f301b7403ca
parent9d93505cc4daed75fda4ba7cbe7476263ab70615 (diff)
downloadportage-2d7ef0838f59e03cc27ef0d8576538591704781e.tar.gz
portage-2d7ef0838f59e03cc27ef0d8576538591704781e.tar.bz2
portage-2d7ef0838f59e03cc27ef0d8576538591704781e.zip
To simplify code, use startswith() instead of slices.
svn path=/main/trunk/; revision=3686
-rwxr-xr-xbin/repoman6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/repoman b/bin/repoman
index 4f53d6a4c..ebd3882a5 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -435,14 +435,14 @@ if "PWD" in os.environ and os.environ["PWD"] != mydir and \
# orient itself if the user has symlinks in their portage tree structure.
# We use os.environ["PWD"], if available, to get the non-canonical path of
# the current working directory (from the shell).
- mydir = os.environ["PWD"]
+ mydir = os.path.normpath(os.environ["PWD"])
if mydir[-1] != "/":
mydir += "/"
for overlay in repoman_settings["PORTDIR_OVERLAY"].split():
if overlay[-1] != "/":
overlay += "/"
- if mydir[:len(overlay)] == overlay:
+ if mydir.startswith(overlay):
portdir_overlay = overlay
subdir = mydir[len(overlay):]
if subdir and subdir[-1] != "/":
@@ -452,7 +452,7 @@ for overlay in repoman_settings["PORTDIR_OVERLAY"].split():
break
if not portdir_overlay:
- if (repoman_settings["PORTDIR"]+"/")[:len(mydir)] == mydir:
+ if (repoman_settings["PORTDIR"] + os.path.sep).startswith(mydir):
portdir_overlay = repoman_settings["PORTDIR"]
else:
portdir_overlay = have_profile_dir(mydir)