LEFT | RIGHT |
1 #!@PYTHON@ | 1 #!@PYTHON@ |
2 | 2 |
3 ## This is www_post.py. This script is the main stage | 3 ## This is www_post.py. This script is the main stage |
4 ## of toplevel GNUmakefile local-WWW-post target. | 4 ## of toplevel GNUmakefile local-WWW-post target. |
5 | 5 |
6 # USAGE: www_post PACKAGE_NAME TOPLEVEL_VERSION OUTDIR TARGETS | 6 # USAGE: www_post PACKAGE_NAME TOPLEVEL_VERSION OUTDIR TARGETS |
7 # please call me from top of the source directory | 7 # please call me from top of the source directory |
8 | 8 |
| 9 import codecs |
9 import sys | 10 import sys |
10 import os | 11 import os |
11 import re | 12 import re |
12 | 13 |
13 import langdefs | 14 import langdefs |
14 | 15 |
15 import mirrortree | 16 import mirrortree |
16 import postprocess_html | 17 import postprocess_html |
17 | 18 |
18 package_name, package_version, outdir, targets = sys.argv[1:] | 19 package_name, package_version, outdir, targets = sys.argv[1:] |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 html_files = [] | 64 html_files = [] |
64 hardlinked_files = [] | 65 hardlinked_files = [] |
65 # These whitelisted files actually do contain the string | 66 # These whitelisted files actually do contain the string |
66 # 'UNTRANSLATED NODE: IGNORE ME' for documentation purposes. | 67 # 'UNTRANSLATED NODE: IGNORE ME' for documentation purposes. |
67 whitelisted_files = [ | 68 whitelisted_files = [ |
68 'Documentation/out-www/contributor-big-page.html', | 69 'Documentation/out-www/contributor-big-page.html', |
69 'Documentation/out-www/contributor/website-build.html', | 70 'Documentation/out-www/contributor/website-build.html', |
70 ] | 71 ] |
71 for f in files: | 72 for f in files: |
72 if f.endswith ('.html'): | 73 if f.endswith ('.html'): |
73 if f in whitelisted_files or not 'UNTRANSLATED NODE: IGNORE ME' in open
(f).read (): | 74 contents = codecs.open (f, 'r', 'utf-8').read () |
| 75 if f in whitelisted_files or not 'UNTRANSLATED NODE: IGNORE ME' in conte
nts: |
74 html_files.append (f) | 76 html_files.append (f) |
75 else: | 77 else: |
76 hardlinked_files.append (f) | 78 hardlinked_files.append (f) |
77 dirs = [re.sub ('/' + outdir, '', d) for d in dirs] | 79 dirs = [re.sub ('/' + outdir, '', d) for d in dirs] |
78 while outdir in dirs: | 80 while outdir in dirs: |
79 dirs.remove (outdir) | 81 dirs.remove (outdir) |
80 dirs = list (set (dirs)) | 82 dirs = list (set (dirs)) |
81 dirs.sort () | 83 dirs.sort () |
82 | 84 |
83 strip_file_name = {} | 85 strip_file_name = {} |
(...skipping 27 matching lines...) Expand all Loading... |
111 | 113 |
112 postprocess_html.build_pages_dict (html_files) | 114 postprocess_html.build_pages_dict (html_files) |
113 for t in targets: | 115 for t in targets: |
114 sys.stderr.write ("Processing HTML pages for %s target...\n" % t) | 116 sys.stderr.write ("Processing HTML pages for %s target...\n" % t) |
115 postprocess_html.process_html_files ( | 117 postprocess_html.process_html_files ( |
116 package_name = package_name, | 118 package_name = package_name, |
117 package_version = package_version, | 119 package_version = package_version, |
118 target = t, | 120 target = t, |
119 name_filter = strip_file_name[t]) | 121 name_filter = strip_file_name[t]) |
120 | 122 |
LEFT | RIGHT |