Allow setting markupsafe directory in CMake.
This CL updates the configuration to allow providing the markupsafe
folder in the CMake configuration. The generator is updated in order to
in set the folder into the path so `jinja2` can find markupsafe.
Change-Id: I3b79deba0d8c2af9c751ddb63c4febc542e904df
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126661
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/generator/generator_lib.py b/generator/generator_lib.py
index c198722..0d34b88 100644
--- a/generator/generator_lib.py
+++ b/generator/generator_lib.py
@@ -90,6 +90,16 @@
# --jinja2-path isn't passed, ignore the exception and just import Jinja2
# assuming it already is in the Python PATH.
pass
+kMarkupSafePath = '--markupsafe-path'
+try:
+ markupsafe_path_argv_index = sys.argv.index(kMarkupSafePath)
+ # Add parent path for the import to succeed.
+ path = os.path.join(sys.argv[markupsafe_path_argv_index + 1], os.pardir)
+ sys.path.insert(1, path)
+except ValueError:
+ # --markupsafe-path isn't passed, ignore the exception and just import
+ # assuming it already is in the Python PATH.
+ pass
import jinja2
@@ -237,6 +247,11 @@
type=str,
help='Additional python path to set before loading Jinja2')
parser.add_argument(
+ kMarkupSafePath,
+ default=None,
+ type=str,
+ help='Additional python path to set before loading MarkupSafe')
+ parser.add_argument(
'--output-json-tarball',
default=None,
type=str,