comparison roundup/scripts/roundup_gettext.py @ 6044:32a5a54536b5

flake8 whitespace fixes.
author John Rouillard <rouilj@ieee.org>
date Tue, 07 Jan 2020 21:38:56 -0500
parents 64b05e24dbd8
children d1c29284ccd9
comparison
equal deleted inserted replaced
6043:937fff530ccd 6044:32a5a54536b5
26 26
27 # name of message template file. 27 # name of message template file.
28 # i don't think this will ever need to be changed, but still... 28 # i don't think this will ever need to be changed, but still...
29 TEMPLATE_FILE = "messages.pot" 29 TEMPLATE_FILE = "messages.pot"
30 30
31
31 def run(): 32 def run():
32 # return unless command line arguments contain single directory path 33 # return unless command line arguments contain single directory path
33 if (len(sys.argv) != 2) or (sys.argv[1] in ("-h", "--help")): 34 if (len(sys.argv) != 2) or (sys.argv[1] in ("-h", "--help")):
34 print(_("Usage: %(program)s <tracker home>") % {"program": sys.argv[0]}) 35 print(_("Usage: %(program)s <tracker home>") %
36 {"program": sys.argv[0]})
35 return 37 return
36 # collect file paths of html templates 38 # collect file paths of html templates
37 home = os.path.abspath(sys.argv[1]) 39 home = os.path.abspath(sys.argv[1])
38 htmldir = os.path.join(home, "html") 40 htmldir = os.path.join(home, "html")
39 if os.path.isdir(htmldir): 41 if os.path.isdir(htmldir):
40 # glob is not used because i want to match file names 42 # glob is not used because i want to match file names
41 # without case sensitivity, and that is easier done this way. 43 # without case sensitivity, and that is easier done this way.
42 htmlfiles = [filename for filename in os.listdir(htmldir) 44 htmlfiles = [filename for filename in os.listdir(htmldir)
43 if os.path.isfile(os.path.join(htmldir, filename)) 45 if os.path.isfile(os.path.join(htmldir, filename))
44 and filename.lower().endswith(".html")] 46 and filename.lower().endswith(".html")]
45 else: 47 else:
46 htmlfiles = [] 48 htmlfiles = []
47 # return if no html files found 49 # return if no html files found
48 if not htmlfiles: 50 if not htmlfiles:
49 print(_("No tracker templates found in directory %s") % home) 51 print(_("No tracker templates found in directory %s") % home)
58 sys.argv[1:] = ["-o", TEMPLATE_FILE] \ 60 sys.argv[1:] = ["-o", TEMPLATE_FILE] \
59 + ["../html/" + filename for filename in htmlfiles] 61 + ["../html/" + filename for filename in htmlfiles]
60 # run 62 # run
61 talgettext.main() 63 talgettext.main()
62 64
65
63 if __name__ == "__main__": 66 if __name__ == "__main__":
64 run() 67 run()
65 68
66 # vim: set et sts=4 sw=4 : 69 # vim: set et sts=4 sw=4 :

Roundup Issue Tracker: http://roundup-tracker.org/