summaryrefslogtreecommitdiff
path: root/pygnulib/constants.py
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2022-07-31 18:30:50 +0200
committerBruno Haible <bruno@clisp.org>2022-07-31 23:52:09 +0200
commitcc88acbb6555991c2ee1ed22ad11215a904c0761 (patch)
treee8bc492d36763a9cda2992ca88f3f7ff8e9df3cc /pygnulib/constants.py
parentfbc5bcf37a8acf1710b8bc3c0dc813531f36206d (diff)
downloadgnulib-cc88acbb6555991c2ee1ed22ad11215a904c0761.tar.gz
gnulib-tool.py: Follow gnulib-tool changes, part 18.
Follow gnulib-tool change 2005-09-20 Bruno Haible <bruno@clisp.org> gnulib-tool: Remove trailing slashes * pygnulib/constants.py (remove_trailing_slashes): New function. * pygnulib/GLConfig.py (GLConfig): Use it in the setters.
Diffstat (limited to 'pygnulib/constants.py')
-rw-r--r--pygnulib/constants.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/pygnulib/constants.py b/pygnulib/constants.py
index 8fd982f7a7..e951c906d0 100644
--- a/pygnulib/constants.py
+++ b/pygnulib/constants.py
@@ -394,6 +394,18 @@ def nlremove(text):
return text
+def remove_trailing_slashes(text):
+ '''Remove trailing slashes from a file name, except when the file name
+ consists only of slashes.'''
+ result = text
+ while result.endswith('/'):
+ result = result[:-1]
+ if result == '':
+ result = text
+ break
+ return result
+
+
def remove_backslash_newline(text):
'''Given a multiline string text, join lines:
When a line ends in a backslash, remove the backslash and join the next