| 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 <structure> element. | 6 '''The <structure> element. |
| 7 ''' | 7 ''' |
| 8 | 8 |
| 9 import os | 9 import os |
| 10 import platform | 10 import platform |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 create_file: True | 284 create_file: True |
| 285 ''' | 285 ''' |
| 286 assert self.HasFileForLanguage() | 286 assert self.HasFileForLanguage() |
| 287 # If the source language is requested, and no extra changes are requested, | 287 # If the source language is requested, and no extra changes are requested, |
| 288 # use the existing file. | 288 # use the existing file. |
| 289 if ((not lang or lang == self.GetRoot().GetSourceLanguage()) and | 289 if ((not lang or lang == self.GetRoot().GetSourceLanguage()) and |
| 290 self.attrs['expand_variables'] != 'true' and | 290 self.attrs['expand_variables'] != 'true' and |
| 291 (not self.attrs['run_command'] or | 291 (not self.attrs['run_command'] or |
| 292 not self.RunCommandOnCurrentPlatform())): | 292 not self.RunCommandOnCurrentPlatform())): |
| 293 if return_if_not_generated: | 293 if return_if_not_generated: |
| 294 return self.ToRealPath(self.GetInputPath()) | 294 input_path = self.GetInputPath() |
| 295 if input_path is None: |
| 296 return None |
| 297 return self.ToRealPath(input_path) |
| 295 else: | 298 else: |
| 296 return None | 299 return None |
| 297 | 300 |
| 298 if self.attrs['output_filename'] != '': | 301 if self.attrs['output_filename'] != '': |
| 299 filename = self.attrs['output_filename'] | 302 filename = self.attrs['output_filename'] |
| 300 else: | 303 else: |
| 301 filename = os.path.basename(self.attrs['file']) | 304 filename = os.path.basename(self.attrs['file']) |
| 302 assert len(filename) | 305 assert len(filename) |
| 303 filename = '%s_%s' % (lang, filename) | 306 filename = '%s_%s' % (lang, filename) |
| 304 filename = os.path.join(output_dir, filename) | 307 filename = os.path.join(output_dir, filename) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 def SubstituteMessages(self, substituter): | 361 def SubstituteMessages(self, substituter): |
| 359 '''Propagates substitution to gatherer. | 362 '''Propagates substitution to gatherer. |
| 360 | 363 |
| 361 Args: | 364 Args: |
| 362 substituter: a grit.util.Substituter object. | 365 substituter: a grit.util.Substituter object. |
| 363 ''' | 366 ''' |
| 364 assert hasattr(self, 'gatherer') | 367 assert hasattr(self, 'gatherer') |
| 365 if self.ExpandVariables(): | 368 if self.ExpandVariables(): |
| 366 self.gatherer.SubstituteMessages(substituter) | 369 self.gatherer.SubstituteMessages(substituter) |
| 367 | 370 |
| OLD | NEW |