From d399f35eb6c3d78bd1bdf0a358c87a722151fa13 Mon Sep 17 00:00:00 2001 From: hosted-fornet Date: Tue, 10 Sep 2024 22:58:57 -0700 Subject: [PATCH] continue debugging workflow 23 --- code/ws_client/requirements.sh | 15 ++++++++++++++- code/ws_server/requirements.sh | 15 ++++++++++++++- code/ws_server_with_reply/requirements.sh | 15 ++++++++++++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/code/ws_client/requirements.sh b/code/ws_client/requirements.sh index b2adcc43..af1745c4 100755 --- a/code/ws_client/requirements.sh +++ b/code/ws_client/requirements.sh @@ -1,5 +1,17 @@ #!/bin/bash +crossplatform_realpath_inner() { + python -c "import os; print(os.path.realpath('$1'))" +} + +crossplatform_realpath() { + if [ -e "$1" ] || [ -L "$1" ]; then + crossplatform_realpath_inner "$1" + else + return 1 + fi +} + # Check if pip is installed and install it if it is not. if ! command -v pip &> /dev/null then @@ -13,7 +25,8 @@ python -m pip install --upgrade pip # Install packages from the requirements.txt file. if [ -f "requirements.txt" ]; then echo "Installing packages from requirements.txt..." - pip install -r requirements.txt + script_dir=$(dirname "$(crossplatform_realpath "${BASH_SOURCE[0]}")") + pip install -r ${script_dir}/requirements.txt else echo "Error: requirements.txt does not exist." exit 0 diff --git a/code/ws_server/requirements.sh b/code/ws_server/requirements.sh index b2adcc43..af1745c4 100755 --- a/code/ws_server/requirements.sh +++ b/code/ws_server/requirements.sh @@ -1,5 +1,17 @@ #!/bin/bash +crossplatform_realpath_inner() { + python -c "import os; print(os.path.realpath('$1'))" +} + +crossplatform_realpath() { + if [ -e "$1" ] || [ -L "$1" ]; then + crossplatform_realpath_inner "$1" + else + return 1 + fi +} + # Check if pip is installed and install it if it is not. if ! command -v pip &> /dev/null then @@ -13,7 +25,8 @@ python -m pip install --upgrade pip # Install packages from the requirements.txt file. if [ -f "requirements.txt" ]; then echo "Installing packages from requirements.txt..." - pip install -r requirements.txt + script_dir=$(dirname "$(crossplatform_realpath "${BASH_SOURCE[0]}")") + pip install -r ${script_dir}/requirements.txt else echo "Error: requirements.txt does not exist." exit 0 diff --git a/code/ws_server_with_reply/requirements.sh b/code/ws_server_with_reply/requirements.sh index b2adcc43..af1745c4 100755 --- a/code/ws_server_with_reply/requirements.sh +++ b/code/ws_server_with_reply/requirements.sh @@ -1,5 +1,17 @@ #!/bin/bash +crossplatform_realpath_inner() { + python -c "import os; print(os.path.realpath('$1'))" +} + +crossplatform_realpath() { + if [ -e "$1" ] || [ -L "$1" ]; then + crossplatform_realpath_inner "$1" + else + return 1 + fi +} + # Check if pip is installed and install it if it is not. if ! command -v pip &> /dev/null then @@ -13,7 +25,8 @@ python -m pip install --upgrade pip # Install packages from the requirements.txt file. if [ -f "requirements.txt" ]; then echo "Installing packages from requirements.txt..." - pip install -r requirements.txt + script_dir=$(dirname "$(crossplatform_realpath "${BASH_SOURCE[0]}")") + pip install -r ${script_dir}/requirements.txt else echo "Error: requirements.txt does not exist." exit 0