3 # Script to update Smarty template files from all internal templates
4 # Copyright 2013 Zach Prezkuta
5 # Licensed under GPL v3
15 print "\t" + pname + " -h\n\n\t\t\tShow this help screen\n"
16 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"
17 print "\t" + pname + "\n\n\t\t\tInteractive mode\n"
28 opts, args = getopt.getopt(sys.argv[1:], "hp:")
35 except getopt.GetoptError:
40 path = raw_input('Path to top-level Friendica directory: ')
46 names = os.listdir(path + 'view/')
48 if os.path.isdir(path + 'view/' + name):
49 if name != 'smarty3' and name != 'theme':
50 tplpaths.append('view/' + name + '/')
52 names = os.listdir(path + 'view/theme/')
54 if os.path.isdir(path + 'view/theme/' + name):
55 tplpaths.append('view/theme/' + name + '/')
57 fnull = open(os.devnull, "w")
59 for tplpath in tplpaths:
60 print "Converting " + path + tplpath
61 subprocess.call(['python', path + 'util/friendica-to-smarty-tpl.py', '-p', path + tplpath], stdout = fnull)