| Index: tools/isolate_driver.py
|
| diff --git a/tools/isolate_driver.py b/tools/isolate_driver.py
|
| index d1b39b095828dc634d2d49b1d40b32ec9d1638d6..154235302e50eb3bf7496c9d69431194dedfcfc7 100644
|
| --- a/tools/isolate_driver.py
|
| +++ b/tools/isolate_driver.py
|
| @@ -30,6 +30,16 @@ def prepare_isolate_call(args, output):
|
| 'version': 1,
|
| }, f, indent=2, sort_keys=True)
|
|
|
| +def rebase_directories(args, abs_base):
|
| + """Rebases all paths to be relative to abs_base."""
|
| + def replace(index):
|
| + args[index] = os.path.relpath(os.path.abspath(args[index]), abs_base)
|
| + for i, arg in enumerate(args):
|
| + if arg in ['--isolate', '--isolated']:
|
| + replace(i + 1)
|
| + if arg == '--path-variable':
|
| + # Path variables have a triple form: --path-variable NAME <path>.
|
| + replace(i + 2)
|
|
|
| def main():
|
| logging.basicConfig(level=logging.ERROR, format='%(levelname)7s %(message)s')
|
| @@ -49,6 +59,14 @@ def main():
|
| print >> sys.stderr, 'Internal failure'
|
| return 1
|
|
|
| + # Make sure all paths are relative to the isolate file. This is an
|
| + # expectation of the go binaries. In gn, this script is not called
|
| + # relative to the isolate file, but relative to the product dir.
|
| + new_base = os.path.abspath(os.path.dirname(args[isolate]))
|
| + rebase_directories(args, new_base)
|
| + assert args[isolate] == os.path.basename(args[isolate])
|
| + os.chdir(new_base)
|
| +
|
| # In 'prepare' mode just collect all required information for postponed
|
| # isolated.py invocation later, store it in *.isolated.gen.json file.
|
| if mode == 'prepare':
|
|
|