Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: testing/tools/fixup_pdf_template.py

Issue 912803004: Create run_javascript_tests.py (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 80 cols Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: testing/tools/fixup_pdf_template.py
diff --git a/testing/tools/fixup_pdf_template.py b/testing/tools/fixup_pdf_template.py
index 87996a42cd58e0506054fd4b880d7bd12c61e58b..390f438543acc464376a631e7c98fb3cd325f006 100755
--- a/testing/tools/fixup_pdf_template.py
+++ b/testing/tools/fixup_pdf_template.py
@@ -70,9 +70,12 @@ class TemplateProcessor:
self.offset += len(line)
return line
-def expand_file(input_filename):
+def expand_file(input_filename, output_dir):
Lei Zhang 2015/02/10 23:09:29 Two blank lines between top-level definitions: htt
Tom Sepez 2015/02/10 23:33:31 Done.
(input_root, extension) = os.path.splitext(input_filename)
Lei Zhang 2015/02/10 23:09:29 BTW, if you don't need |extension|, you can just p
Tom Sepez 2015/02/10 23:33:31 Done.
- output_filename = input_root + '.pdf'
+ output_filename = os.path.join(output_dir, input_root + '.pdf')
+ output_dirname = os.path.dirname(output_filename)
+ if not os.path.exists(output_dirname):
+ os.makedirs(output_dirname)
processor = TemplateProcessor()
try:
with open(input_filename, 'r') as infile:
@@ -83,8 +86,14 @@ def expand_file(input_filename):
print >> sys.stderr, 'failed to process %s' % input_filename
def main():
- for arg in sys.argv[1:]:
- expand_file(arg)
+ parser = optparse.OptionParser()
+ parser.add_option('--build-dir', default='')
+ (options, args) = parser.parse_args()
+ working_dir = options.build_dir
+ if working_dir:
+ working_dir = os.path.join(options.build_dir, 'gen', 'pdfium')
+ for arg in args:
+ expand_file(arg, working_dir)
return 0
if __name__ == '__main__':

Powered by Google App Engine
This is Rietveld 408576698