From 52dbfb144f5c91d2f30ac2b83937958b211875ee Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Thu, 4 Jun 2015 19:18:42 +0200 Subject: Replace _strip_trailing_slash() with rstrip(). Will also strip many '/'s, which makes sense here. --- kconfiglib.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'kconfiglib.py') diff --git a/kconfiglib.py b/kconfiglib.py index 1b4ac3d..abc42ca 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -166,7 +166,7 @@ class Config(object): self.srctree = "." self.filename = filename - self.base_dir = _strip_trailing_slash(os.path.expandvars(base_dir)) + self.base_dir = os.path.expandvars(base_dir).rstrip("/") # The 'mainmenu' text self.mainmenu_text = None @@ -3739,15 +3739,11 @@ def _get_lines(filename): accum = "" return lines -def _strip_trailing_slash(path): - """Removes any trailing slash from 'path'.""" - return path[:-1] if path.endswith("/") else path - def _clean_up_path(path): """Strips any initial "./" and trailing slash from 'path'.""" if path.startswith("./"): path = path[2:] - return _strip_trailing_slash(path) + return path.rstrip("/") # # Error handling -- cgit v1.2.3