From 02ec8ede64d08819b6645233e6755d62f907c88c Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Wed, 9 Sep 2020 15:24:26 -0400 Subject: [PATCH] PYTHONPATH in dev-env setup Former-commit-id: a3cf8261883c7394d3ce5a2188f466fd3dc6de16 --- opendm/context.py | 6 +++++- start-dev-env.sh | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/opendm/context.py b/opendm/context.py index 2e2f4010..5eeba38d 100644 --- a/opendm/context.py +++ b/opendm/context.py @@ -1,6 +1,5 @@ import os import sys -from opendm import io import multiprocessing # Define some needed locations @@ -56,3 +55,8 @@ supported_extensions = {'.jpg','.jpeg','.png', '.tif', '.tiff'} # Define the number of cores num_cores = multiprocessing.cpu_count() + + +# Print python paths if invoked as a script +if __name__ == "__main__": + print("export PYTHONPATH=" + ":".join(python_packages_paths)) \ No newline at end of file diff --git a/start-dev-env.sh b/start-dev-env.sh index 398db153..877dc6af 100755 --- a/start-dev-env.sh +++ b/start-dev-env.sh @@ -12,7 +12,8 @@ if [ "$1" = "--setup" ]; then touch .setupdevenv apt install -y vim - chown -R $3:$4 /code /var/www + chown -R $3:$4 /code + chown -R $3:$4 /var/www fi echo "Adding $2 to /etc/passwd" @@ -44,7 +45,10 @@ if [ "$1" = "--setup" ]; then # Colors echo "alias ls='ls --color=auto'" >> $HOME/.bashrc - su -c bash $2 + # Python paths + echo $(python /code/opendm/context.py) >> $HOME/.bashrc + + su -c bash $2 exit 0 fi