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

Side by Side Diff: Source/core/scripts/in_generator.py

Issue 14696003: in_file.py should be able to parse "in" files (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 18 matching lines...) Expand all
29 import os.path 29 import os.path
30 import shutil 30 import shutil
31 31
32 from in_file import InFile 32 from in_file import InFile
33 33
34 34
35 class Writer(object): 35 class Writer(object):
36 # Subclasses should override. 36 # Subclasses should override.
37 class_name = None 37 class_name = None
38 defaults = None 38 defaults = None
39 default_parameters = None
39 40
40 def __init__(self, in_file_path): 41 def __init__(self, in_file_path):
41 self.in_file = InFile.load_from_path(in_file_path, self.defaults) 42 self.in_file = InFile.load_from_path(in_file_path, self.defaults, self.d efault_parameters)
42 43
43 # Subclasses should override. 44 # Subclasses should override.
44 def generate_header(self): 45 def generate_header(self):
45 raise NotImplementedError 46 raise NotImplementedError
46 47
47 # Subclasses should override. 48 # Subclasses should override.
48 def generate_implementation(self): 49 def generate_implementation(self):
49 raise NotImplementedError 50 raise NotImplementedError
50 51
51 def _forcibly_create_text_file_at_path_with_contents(self, file_path, conten ts): 52 def _forcibly_create_text_file_at_path_with_contents(self, file_path, conten ts):
(...skipping 28 matching lines...) Expand all
80 script_name = os.path.basename(argv[0]) 81 script_name = os.path.basename(argv[0])
81 args = argv[1:] 82 args = argv[1:]
82 if len(args) < 1: 83 if len(args) < 1:
83 print "USAGE: %i INPUT_FILE [OUTPUT_DIRECTORY]" % script_name 84 print "USAGE: %i INPUT_FILE [OUTPUT_DIRECTORY]" % script_name
84 exit(1) 85 exit(1)
85 output_dir = args[1] if len(args) > 1 else os.getcwd() 86 output_dir = args[1] if len(args) > 1 else os.getcwd()
86 87
87 writer = self._writer_class(args[0]) 88 writer = self._writer_class(args[0])
88 writer.write_header(output_dir) 89 writer.write_header(output_dir)
89 writer.write_implmentation(output_dir) 90 writer.write_implmentation(output_dir)
OLDNEW
« Source/core/scripts/in_file_unittest.py ('K') | « Source/core/scripts/in_file_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698