Chromium Code Reviews| Index: pylib/gyp/input.py |
| =================================================================== |
| --- pylib/gyp/input.py (revision 1758) |
| +++ pylib/gyp/input.py (working copy) |
| @@ -781,7 +781,7 @@ |
| # Find the build file's directory, so commands can be run or file lists |
| # generated relative to it. |
| build_file_dir = os.path.dirname(build_file) |
| - if build_file_dir == '': |
| + if build_file_dir == '' and not file_list: |
| # If build_file is just a leaf filename indicating a file in the |
| # current directory, build_file_dir might be an empty string. Set |
| # it to None to signal to subprocess.Popen that it should run the |
| @@ -798,9 +798,11 @@ |
| else: |
| contents_list = contents.split(' ') |
| replacement = contents_list[0] |
| - path = replacement |
| - if build_file_dir and not os.path.isabs(path): |
| - path = os.path.join(build_file_dir, path) |
| + if os.path.isabs(replacement): |
| + raise GypError('| cannot handle absolute paths, got "%s"' % path) |
| + |
| + path = generator_file_path(build_file_dir, replacement) |
|
scottmg
2013/10/16 23:29:48
this would keep path as replacement before if not
|
| + replacement = gyp.common.RelativePath(path, build_file_dir) |
| f = gyp.common.WriteOnDiff(path) |
| for i in contents_list[1:]: |
| f.write('%s\n' % i) |
| @@ -2599,6 +2601,11 @@ |
| multiple_toolsets = generator_input_info[ |
| 'generator_supports_multiple_toolsets'] |
| + global generator_file_path |
| + generator_file_path = generator_input_info['generator_file_path'] |
| + if not generator_file_path: |
| + generator_file_path = lambda a, b: os.path.join(a, b) |
| + |
| # A generator can have other lists (in addition to sources) be processed |
| # for rules. |
| extra_sources_for_rules = generator_input_info['extra_sources_for_rules'] |