aboutsummaryrefslogtreecommitdiffstats
path: root/util/updatetpl.py
diff options
context:
space:
mode:
authorHaakon Meland Eriksen <haakon.eriksen@far.no>2014-06-24 19:34:36 +0200
committerHaakon Meland Eriksen <haakon.eriksen@far.no>2014-06-24 19:34:36 +0200
commitb8dc9e855af2d30f33d0f90dc13d8cad0a7b3e70 (patch)
tree718df6305bcb82c8dcb4b287a7132422e748cdfb /util/updatetpl.py
parentc2d520f1be115fb3cb5da2a35eb10146cecee8aa (diff)
parenta92fb0b04c3e6474ec48faf8e4cc65c382e89d66 (diff)
downloadvolse-hubzilla-b8dc9e855af2d30f33d0f90dc13d8cad0a7b3e70.tar.gz
volse-hubzilla-b8dc9e855af2d30f33d0f90dc13d8cad0a7b3e70.tar.bz2
volse-hubzilla-b8dc9e855af2d30f33d0f90dc13d8cad0a7b3e70.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'util/updatetpl.py')
-rwxr-xr-xutil/updatetpl.py68
1 files changed, 68 insertions, 0 deletions
diff --git a/util/updatetpl.py b/util/updatetpl.py
new file mode 100755
index 000000000..7a3801352
--- /dev/null
+++ b/util/updatetpl.py
@@ -0,0 +1,68 @@
+#!/usr/bin/python
+#
+# Script to update Smarty template files from all internal templates
+# Copyright 2013 Zach Prezkuta
+# Licensed under GPL v3
+
+
+import os
+import sys, getopt
+import subprocess
+
+
+def help(pname):
+ print "\nUsage:"
+ print "\t" + pname + " -h\n\n\t\t\tShow this help screen\n"
+ print "\t" + pname + " -p directory\n\n\t\t\tConvert all .tpl files in top-level\n\t\t\tFriendica directory to Smarty templates\n"
+ print "\t" + pname + "\n\n\t\t\tInteractive mode\n"
+
+
+
+#
+# Main script
+#
+
+path = ''
+
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "hp:")
+ for opt, arg in opts:
+ if opt == '-h':
+ help(sys.argv[0])
+ sys.exit()
+ elif opt == '-p':
+ path = arg
+except getopt.GetoptError:
+ help(sys.argv[0])
+ sys.exit(2)
+
+if path == '':
+ path = raw_input('Path to top-level Friendica directory: ')
+
+if path == '':
+ path = '.'
+
+if path[-1:] != '/':
+ path = path + '/'
+
+excludepaths = ['css', 'img', 'js', 'php', 'theme']
+tplpaths = []
+names = os.listdir(path + 'view/')
+for name in names:
+ if os.path.isdir(path + 'view/' + name):
+ if name not in excludepaths:
+ tplpaths.append('view/' + name + '/')
+
+names = os.listdir(path + 'view/theme/')
+for name in names:
+ if os.path.isdir(path + 'view/theme/' + name):
+ tplpaths.append('view/theme/' + name + '/tpl/')
+
+fnull = open(os.devnull, "w")
+
+for tplpath in tplpaths:
+ print "Converting " + path + tplpath
+ subprocess.call(['python', path + 'util/friendica-to-smarty-tpl.py', '-p', path + tplpath], stdout = fnull)
+
+fnull.close()
+