From d4baaefc9bc0034c63bf3cda0387bf1d20494228 Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Tue, 13 Aug 2024 01:54:44 +0200 Subject: [PATCH] Use platform-independent way to add src/ to PYTHONPATH --- build-docs.sh | 2 +- build_scripts/pythonpath.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 build_scripts/pythonpath.py diff --git a/build-docs.sh b/build-docs.sh index 3eb4b749..2838e641 100644 --- a/build-docs.sh +++ b/build-docs.sh @@ -1,4 +1,4 @@ -export PYTHONPATH="$PYTHONPATH:$(pwd)/src" +export PYTHONPATH="$(python build_scripts/pythonpath.py)" rm -rf docs/build rm -rf docs/jupyter_execute jupyter-book config sphinx docs/ diff --git a/build_scripts/pythonpath.py b/build_scripts/pythonpath.py new file mode 100644 index 00000000..3b1dd124 --- /dev/null +++ b/build_scripts/pythonpath.py @@ -0,0 +1,5 @@ +import os + +SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) + +print(os.environ["PYTHONPATH"] + os.pathsep + os.path.abspath(os.path.join(SCRIPT_DIR, "..", "src")))