diff options
author | Bruno Haible <bruno@clisp.org> | 2022-07-31 18:30:50 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2022-07-31 23:52:09 +0200 |
commit | cc88acbb6555991c2ee1ed22ad11215a904c0761 (patch) | |
tree | e8bc492d36763a9cda2992ca88f3f7ff8e9df3cc /pygnulib/constants.py | |
parent | fbc5bcf37a8acf1710b8bc3c0dc813531f36206d (diff) | |
download | gnulib-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.py | 12 |
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 |