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

Side by Side Diff: ppapi/generators/idl_outfile.py

Issue 7715036: More multi-version support (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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
« no previous file with comments | « ppapi/generators/idl_node.py ('k') | ppapi/generators/test_cgen/enum_typedef.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """ Output file objects for generator. """ 7 """ Output file objects for generator. """
8 8
9 import difflib 9 import difflib
10 import os 10 import os
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 # Close the file 77 # Close the file
78 def Close(self): 78 def Close(self):
79 filename = os.path.realpath(self.filename) 79 filename = os.path.realpath(self.filename)
80 self.open = False 80 self.open = False
81 outtext = ''.join(self.outlist) 81 outtext = ''.join(self.outlist)
82 if not self.always_write: 82 if not self.always_write:
83 if os.path.isfile(filename): 83 if os.path.isfile(filename):
84 intext = open(filename, 'r').read() 84 intext = open(filename, 'r').read()
85 else: 85 else:
86 intext = None 86 intext = ''
87 87
88 if IsEquivelent(intext, outtext): 88 if IsEquivelent(intext, outtext):
89 if GetOption('verbose'): 89 if GetOption('verbose'):
90 InfoOut.Log('Output %s unchanged.' % self.filename) 90 InfoOut.Log('Output %s unchanged.' % self.filename)
91 return False 91 return False
92 92
93 if GetOption('diff'): 93 if GetOption('diff'):
94 for line in difflib.unified_diff(intext.split('\n'), outtext.split('\n'), 94 for line in difflib.unified_diff(intext.split('\n'), outtext.split('\n'),
95 self.filename, 'NEW', n=1, lineterm=''): 95 self.filename, 'NEW', n=1, lineterm=''):
96 ErrOut.Log(line) 96 ErrOut.Log(line)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 errors += TestFile(filename, stringlist, force=False, update=False) 165 errors += TestFile(filename, stringlist, force=False, update=False)
166 166
167 # Test conditionally writing the file updating 167 # Test conditionally writing the file updating
168 errors += TestFile(filename, stringlist + ['X'], force=False, update=True) 168 errors += TestFile(filename, stringlist + ['X'], force=False, update=True)
169 169
170 # Clean up file 170 # Clean up file
171 os.remove(filename) 171 os.remove(filename)
172 if not errors: InfoOut.Log('All tests pass.') 172 if not errors: InfoOut.Log('All tests pass.')
173 sys.exit(errors) 173 sys.exit(errors)
174 174
OLDNEW
« no previous file with comments | « ppapi/generators/idl_node.py ('k') | ppapi/generators/test_cgen/enum_typedef.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698