Write relative paths with forward slashes to the code generation hashes.
This should avoid generating diffs when running the code generation with
different source directories or on different platforms.
BUG=angleproject:2695
Change-Id: I67776883bdbeb867a49bea00f16998c04f7857b4
Reviewed-on: https://chromium-review.googlesource.com/1127355
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/scripts/run_code_generation.py b/scripts/run_code_generation.py
index bf0f6a5..40f5a86 100755
--- a/scripts/run_code_generation.py
+++ b/scripts/run_code_generation.py
@@ -22,9 +22,18 @@
# All script names are relative to ANGLE's root
return os.path.dirname(os.path.abspath(os.path.join(root_dir, script)))
+# Replace all backslashes with forward slashes to be platform independent
+def clean_path_slashes(path):
+ return path.replace("\\", "/")
+
+# Takes a script input file name which is relative to the code generation script's directory and
+# changes it to be relative to the angle root directory
+def rebase_script_input_path(script_path, input_file_path):
+ return os.path.relpath(os.path.join(os.path.dirname(script_path), input_file_path), root_dir);
+
def grab_from_script(script, param):
res = subprocess.check_output(['python', script, param]).strip()
- return [os.path.abspath(os.path.join(os.path.dirname(script), name)) for name in res.split(',')]
+ return [clean_path_slashes(rebase_script_input_path(script, name)) for name in res.split(',')]
def auto_script(script):
# Set the CWD to the script directory.