Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: cms/bin/generate_static_pages.py

Issue 29400555: Issue 4992 - Adds optional revision arg to generate_static_pages (Closed) Base URL: https://hg.adblockplus.org/cms
Left Patch Set: add test coverage for static generation without the optional argument '-r/--rev' Created April 3, 2017, 10:11 a.m.
Right Patch Set: fixed redundant sys.argv definition Created April 4, 2017, 6:59 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | cms/sources.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-2017 eyeo GmbH 2 # Copyright (C) 2006-2017 eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 path = os.path.join(dir, filename) 137 path = os.path.join(dir, filename)
138 if os.path.isfile(path) and path not in known_files: 138 if os.path.isfile(path) and path not in known_files:
139 os.remove(path) 139 os.remove(path)
140 elif os.path.isdir(path): 140 elif os.path.isdir(path):
141 remove_unknown(path) 141 remove_unknown(path)
142 if not os.listdir(path): 142 if not os.listdir(path):
143 os.rmdir(path) 143 os.rmdir(path)
144 remove_unknown(output_dir) 144 remove_unknown(output_dir)
145 145
146 if __name__ == '__main__': 146 if __name__ == '__main__':
147 parser = ArgumentParser() 147 parser = ArgumentParser('Convert website source to static website')
148 parser.add_argument('-r', '--rev', 148 parser.add_argument('-r', '--rev',
149 help='see "hg help revisions" for more details', 149 help=('Specify which revision to generate from. '
150 'See "hg help revisions" for details.'),
150 default='default') 151 default='default')
151 parser.add_argument('source', help="Path to your website's repository") 152 parser.add_argument('source', help="Path to website's repository")
152 parser.add_argument('output', help='Path to the desired output directory') 153 parser.add_argument('output', help='Path to desired output directory')
153 args = parser.parse_args() 154 args = parser.parse_args()
154 generate_pages(args.source, args.output, args.rev) 155 generate_pages(args.source, args.output, args.rev)
LEFTRIGHT
« no previous file | cms/sources.py » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld