| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 '''The 'grit build' tool along with integration for this tool with the | 6 '''The 'grit build' tool along with integration for this tool with the |
| 7 SCons build system. | 7 SCons build system. |
| 8 ''' | 8 ''' |
| 9 | 9 |
| 10 import filecmp | 10 import filecmp |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 Returns true if the asserted files are present. If they are not, returns | 356 Returns true if the asserted files are present. If they are not, returns |
| 357 False and prints the failure. | 357 False and prints the failure. |
| 358 ''' | 358 ''' |
| 359 # Compare the absolute path names, sorted. | 359 # Compare the absolute path names, sorted. |
| 360 asserted = sorted([os.path.abspath(i) for i in assert_output_files]) | 360 asserted = sorted([os.path.abspath(i) for i in assert_output_files]) |
| 361 actual = sorted([ | 361 actual = sorted([ |
| 362 os.path.abspath(os.path.join(self.output_directory, i.GetFilename())) | 362 os.path.abspath(os.path.join(self.output_directory, i.GetFilename())) |
| 363 for i in self.res.GetOutputFiles()]) | 363 for i in self.res.GetOutputFiles()]) |
| 364 | 364 |
| 365 if asserted != actual: | 365 if asserted != actual: |
| 366 print '''Asserted file list does not match. | 366 missing = list(set(actual) - set(asserted)) |
| 367 extra = list(set(asserted) - set(actual)) |
| 368 error = '''Asserted file list does not match. |
| 367 | 369 |
| 368 Expected output files: %s | 370 Expected output files: |
| 369 | 371 %s |
| 370 Actual output files: %s | 372 Actual output files: |
| 371 ''' % (asserted, actual) | 373 %s |
| 374 Missing output files: |
| 375 %s |
| 376 Extra output files: |
| 377 %s |
| 378 ''' |
| 379 print error % ('\n'.join(asserted), '\n'.join(actual), '\n'.join(missing), |
| 380 '\n'.join(extra)) |
| 372 return False | 381 return False |
| 373 return True | 382 return True |
| 374 | 383 |
| 375 | 384 |
| 376 def GenerateDepfile(self, depfile, depdir): | 385 def GenerateDepfile(self, depfile, depdir): |
| 377 '''Generate a depfile that contains the imlicit dependencies of the input | 386 '''Generate a depfile that contains the imlicit dependencies of the input |
| 378 grd. The depfile will be in the same format as a makefile, and will contain | 387 grd. The depfile will be in the same format as a makefile, and will contain |
| 379 references to files relative to |depdir|. It will be put in |depfile|. | 388 references to files relative to |depdir|. It will be put in |depfile|. |
| 380 | 389 |
| 381 For example, supposing we have three files in a directory src/ | 390 For example, supposing we have three files in a directory src/ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 self.MakeDirectoriesTo(depfile) | 425 self.MakeDirectoriesTo(depfile) |
| 417 outfile = self.fo_create(depfile, 'wb') | 426 outfile = self.fo_create(depfile, 'wb') |
| 418 outfile.writelines(depfile_contents) | 427 outfile.writelines(depfile_contents) |
| 419 | 428 |
| 420 @staticmethod | 429 @staticmethod |
| 421 def MakeDirectoriesTo(file): | 430 def MakeDirectoriesTo(file): |
| 422 '''Creates directories necessary to contain |file|.''' | 431 '''Creates directories necessary to contain |file|.''' |
| 423 dir = os.path.split(file)[0] | 432 dir = os.path.split(file)[0] |
| 424 if not os.path.exists(dir): | 433 if not os.path.exists(dir): |
| 425 os.makedirs(dir) | 434 os.makedirs(dir) |
| OLD | NEW |