We need to modify sys.path before we import anything from catapult. Unfortunately we need to modify it according to --outdir, so it needs to happen at runtime rather than import time. I try to split the script into a main which just sets up command line args and sys.path and then imports the main script. This makes it less likely that future maintainers will import something too early. Bug: chromium:1029452 Change-Id: I16bf6257269ab8ab90dd74bff7880de8b5fb8071 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170341 Commit-Queue: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30788}