From 2d7ef0838f59e03cc27ef0d8576538591704781e Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 28 Jun 2006 19:36:52 +0000 Subject: [PATCH] To simplify code, use startswith() instead of slices. svn path=/main/trunk/; revision=3686 --- bin/repoman | 6 +++--- 1 file 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) -- 2.26.2