Don't strip the templates/ prefix of target directory
authorMagnus Hagander <magnus@hagander.net>
Tue, 15 Aug 2017 17:28:48 +0000 (19:28 +0200)
committerMagnus Hagander <magnus@hagander.net>
Tue, 15 Aug 2017 17:28:48 +0000 (19:28 +0200)
It's actually used in the rendering code.

tools/deploystatic/deploystatic.py

index ec6832421cce0cd9a3f6fb35afeee56705208c5d..744567cd91e0d744a406fb1f18dcf5e3c1f51f14 100755 (executable)
@@ -245,16 +245,13 @@ if __name__ == "__main__":
                for relpath, relname in source.walkfiles('templates'):
                        if relpath == 'templates/pages': continue
 
-                       # Remove templates/ prefix, since it will always be there
-                       destrelpath = relpath[len('templates/'):]
-
-                       if not os.path.isdir(os.path.join(args.destpath, destrelpath)):
-                               os.makedirs(os.path.join(args.destpath, destrelpath))
+                       if not os.path.isdir(os.path.join(args.destpath, relpath)):
+                               os.makedirs(os.path.join(args.destpath, relpath))
 
                        relsource = os.path.join(relpath, relname)
-                       source.copy_if_changed(relsource, os.path.join(args.destpath, destrelpath, relname))
+                       source.copy_if_changed(relsource, os.path.join(args.destpath, relsource))
 
-                       knownfiles.append(os.path.join(destrelpath, relname))
+                       knownfiles.append(relsource)
 
                # Look for things to remove
                for dn, subdirs, filenames in os.walk(args.destpath):