summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2015-06-04 19:18:42 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2015-06-04 19:20:36 +0200
commit52dbfb144f5c91d2f30ac2b83937958b211875ee (patch)
treec2cb3aebbb086d08c39d39ffb0bb2aa0e68a67bc
parent4a00586bdaf885c73bc8e735b59dad48889435fd (diff)
Replace _strip_trailing_slash() with rstrip().
Will also strip many '/'s, which makes sense here.
-rw-r--r--kconfiglib.py8
1 files changed, 2 insertions, 6 deletions
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