Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(11)

Side by Side Diff: scripts/build/www_post.py

Issue 5498093: Sketch of not remaking html files (Closed)
Patch Set: Changes following previous review Created 13 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « python/auxiliar/postprocess_html.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 sys 9 import sys
10 import os 10 import os
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 while outdir in dirs: 63 while outdir in dirs:
64 dirs.remove (outdir) 64 dirs.remove (outdir)
65 dirs = list (set (dirs)) 65 dirs = list (set (dirs))
66 dirs.sort () 66 dirs.sort ()
67 67
68 strip_file_name = {} 68 strip_file_name = {}
69 strip_re = re.compile (outdir + '/') 69 strip_re = re.compile (outdir + '/')
70 for t in targets: 70 for t in targets:
71 out_root = target_pattern % t 71 out_root = target_pattern % t
72 strip_file_name[t] = lambda s: os.path.join (target_pattern % t, (strip_re.s ub ('', s))) 72 strip_file_name[t] = lambda s: os.path.join (target_pattern % t, (strip_re.s ub ('', s)))
73 os.mkdir (out_root) 73 if not os.path.exists(out_root):
74 map (os.mkdir, [os.path.join (out_root, d) for d in dirs]) 74 os.mkdir (out_root)
75 for d in dirs:
76 new_dir = os.path.join (out_root, d)
77 if not os.path.exists(new_dir):
78 os.mkdir (new_dir)
75 for f in hardlinked_files: 79 for f in hardlinked_files:
76 os.link (f, strip_file_name[t] (f)) 80 try:
81 os.link (f, strip_file_name[t] (f))
82 except Exception:
83 sys.exc_clear()
Julien Rioux 2012/01/10 13:34:23 Why do you catch this exception? Would it not be s
77 for l in symlinks: 84 for l in symlinks:
78 p = mirrortree.new_link_path (os.path.normpath (os.readlink (l)), os.pat h.dirname (l), strip_re) 85 p = mirrortree.new_link_path (os.path.normpath (os.readlink (l)), os.pat h.dirname (l), strip_re)
79 dest = strip_file_name[t] (l) 86 dest = strip_file_name[t] (l)
80 if not os.path.exists (dest): 87 if not os.path.exists (dest):
81 os.symlink (p, dest) 88 os.symlink (p, dest)
82 89
83 90
84 # need this for content negotiation with documentation index 91 # need this for content negotiation with documentation index
85 if 'online' in targets: 92 if 'online' in targets:
86 f = open (os.path.join (target_pattern % 'online', 'Documentation/.htaccess' ), 'w') 93 f = open (os.path.join (target_pattern % 'online', 'Documentation/.htaccess' ), 'w')
87 f.write ('#.htaccess\nDirectoryIndex index\n') 94 f.write ('#.htaccess\nDirectoryIndex index\n')
88 f.close () 95 f.close ()
89 96
90 postprocess_html.build_pages_dict (html_files) 97 postprocess_html.build_pages_dict (html_files)
91 for t in targets: 98 for t in targets:
92 sys.stderr.write ("Processing HTML pages for %s target...\n" % t) 99 sys.stderr.write ("Processing HTML pages for %s target...\n" % t)
93 postprocess_html.process_html_files ( 100 postprocess_html.process_html_files (
94 package_name = package_name, 101 package_name = package_name,
95 package_version = package_version, 102 package_version = package_version,
96 target = t, 103 target = t,
97 name_filter = strip_file_name[t]) 104 name_filter = strip_file_name[t])
98 105
OLDNEW
« no previous file with comments | « python/auxiliar/postprocess_html.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b