dohtml: restore behavior noted in bug #425214
authorZac Medico <zmedico@gentoo.org>
Tue, 27 Aug 2013 03:59:40 +0000 (20:59 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 27 Aug 2013 03:59:40 +0000 (20:59 -0700)
A trailing slash cause os.path.basename() and os.path.dirname() to
behave differently, causing foo/ to behave similarly to the way that
foo/* behaves. This behavior was broken by normalization in commit
3f67cb453ee1b74894c230459b43855db7fcc410.

bin/dohtml.py

index ec9a80b57f445a70e6a261772b4888db46d01dba..37d5b2ee22bd8eea96173a2757c47d4a35a4f0e5 100755 (executable)
@@ -206,7 +206,14 @@ def main():
        success = False
 
        for x in args:
+               trailing_slash = x[-1:] == os.sep
                x = normalize_path(x)
+               if trailing_slash:
+                       # Modify behavior of basename and dirname
+                       # as noted in bug #425214, causing foo/ to
+                       # behave similarly to the way that foo/*
+                       # behaves.
+                       x += os.sep
                basename = os.path.basename(x)
                dirname  = os.path.dirname(x)
                success |= install(basename, dirname, options)