summary refs log tree commit diff
diff options
context:
space:
mode:
authorMathieu Velten <mathieuv@matrix.org>2022-05-30 17:41:24 +0200
committerGitHub <noreply@github.com>2022-05-30 15:41:24 +0000
commit1fd1856afc4155ee47b3be9829b02d740f9a64d6 (patch)
tree5d53bdafe100e0924cd05f0dd2cf9118483d95ba
parentAdd a migration step to cleanup potential leftovers of bug 11833 (#12784) (diff)
downloadsynapse-1fd1856afc4155ee47b3be9829b02d740f9a64d6.tar.xz
demo: check if we are in a virtualenv before overriding PYTHONPATH (#12916)
-rw-r--r--changelog.d/12916.misc1
-rwxr-xr-xdemo/start.sh11
2 files changed, 7 insertions, 5 deletions
diff --git a/changelog.d/12916.misc b/changelog.d/12916.misc
new file mode 100644
index 0000000000..347eb096db
--- /dev/null
+++ b/changelog.d/12916.misc
@@ -0,0 +1 @@
+Check if we are in a virtual environment before overriding the `PYTHONPATH` environment variable in the demo script.
diff --git a/demo/start.sh b/demo/start.sh
index 96b3a2ceab..fdd75816fb 100755
--- a/demo/start.sh
+++ b/demo/start.sh
@@ -6,11 +6,12 @@ CWD=$(pwd)
 
 cd "$DIR/.." || exit
 
-PYTHONPATH=$(readlink -f "$(pwd)")
-export PYTHONPATH
-
-
-echo "$PYTHONPATH"
+# Do not override PYTHONPATH if we are in a virtual env
+if [ "$VIRTUAL_ENV" = "" ]; then
+    PYTHONPATH=$(readlink -f "$(pwd)")
+    export PYTHONPATH
+	echo "$PYTHONPATH"
+fi
 
 # Create servers which listen on HTTP at 808x and HTTPS at 848x.
 for port in 8080 8081 8082; do