-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
included venv activation for python scripts (#2233)
* add setup script for rfid reader. moved python script * add check for venv activation * fix * fix cd fail behavior (dont start subprocess) * add script for run jukebox for venv. updated docs. * add setup script for audio sink. moved python script * add script for rpc tool. moved python script * add script for sniffer tool. moved python script * fixed parameter passing * fix paths * fix flake8 * fix comments and docs * fixed parameter passing * some fixes * fixed execution rights * some fixes * move scripts to python root again (failing import paths). fixed absolute path in caller scripts * fix relative paths * update notes about config file paths * update caller scripts path handling * update comments * add venv activation to tests * explicit installation of python3-venv not needed * renamed audio setup file. updated docs path. * Update configuration.md * Update coreapps.md * update motd message * fix execution rights for motd file. refactored into own postinstall script * fix execution right for audio setup --------- Co-authored-by: pabera <[email protected]>
- Loading branch information
1 parent
e1b46b6
commit b2a6517
Showing
28 changed files
with
166 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Runner script to ensure | ||
# - correct venv activation | ||
# - independent from working directory | ||
|
||
# Change working directory to project root | ||
SOURCE=${BASH_SOURCE[0]} | ||
SCRIPT_DIR="$(dirname "$SOURCE")" | ||
PROJECT_ROOT="$SCRIPT_DIR"/../.. | ||
cd "$PROJECT_ROOT" || { echo "Could not change directory"; exit 1; } | ||
|
||
source .venv/bin/activate || { echo "ERROR: Failed to activate virtual environment for python"; exit 1; } | ||
|
||
cd src/jukebox || { echo "Could not change directory"; exit 1; } | ||
python run_configure_audio.py $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Runner script to ensure | ||
# - correct venv activation | ||
# - independent from working directory | ||
|
||
# Change working directory to project root | ||
SOURCE=${BASH_SOURCE[0]} | ||
SCRIPT_DIR="$(dirname "$SOURCE")" | ||
PROJECT_ROOT="$SCRIPT_DIR"/../.. | ||
cd "$PROJECT_ROOT" || { echo "Could not change directory"; exit 1; } | ||
|
||
source .venv/bin/activate || { echo "ERROR: Failed to activate virtual environment for python"; exit 1; } | ||
|
||
cd src/jukebox || { echo "Could not change directory"; exit 1; } | ||
python run_register_rfid_reader.py $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
_setup_login_message() { | ||
local login_message_welcome_file="/etc/update-motd.d/99-rpi-jukebox-rfid-welcome" | ||
sudo cp -f "${INSTALLATION_PATH}/resources/system/99-rpi-jukebox-rfid-welcome" "$login_message_welcome_file" | ||
sudo chmod +x "$login_message_welcome_file" | ||
} | ||
|
||
_run_setup_postinstall() { | ||
_setup_login_message | ||
} | ||
|
||
setup_postinstall() { | ||
run_with_log_frame _run_setup_postinstall "Post install" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo " | ||
######################################################### | ||
################################################## | ||
___ __ ______ _ __________ ____ __ _ _ | ||
/ _ \/ // / __ \/ |/ / _/ __/( _ \ / \( \/ ) | ||
/ ___/ _ / /_/ / // // _/ ) _ (( O )) ( | ||
/_/ /_//_/\____/_/|_/___/____/ (____/ \__/(_/\_) | ||
future3 | ||
If you want to run a python script from the project | ||
activate the venv before with 'source .venv/bin/activate' | ||
See also https://github.com/MiczFlor/RPi-Jukebox-RFID/ | ||
blob/future3/main/documentation/developers/python.md | ||
#########################################################" | ||
Welcome to your Phoniebox | ||
################################################## | ||
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Runner script for flak8 to ensure | ||
# - correct config file | ||
# Runner script to ensure | ||
# - correct venv activation | ||
# - independent from working directory | ||
|
||
# Change working directory to location of script | ||
# Change working directory to project root | ||
SOURCE=${BASH_SOURCE[0]} | ||
SCRIPT_DIR="$(dirname "$SOURCE")" | ||
cd "$SCRIPT_DIR" || (echo "Could not change to top-level project directory" && exit 1) | ||
PROJECT_ROOT="$SCRIPT_DIR" | ||
cd "$PROJECT_ROOT" || { echo "Could not change directory"; exit 1; } | ||
|
||
source .venv/bin/activate || { echo "ERROR: Failed to activate virtual environment for python"; exit 1; } | ||
|
||
# Run flake8 | ||
flake8 --config .flake8 "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Runner script to ensure | ||
# - correct venv activation | ||
# - independent from working directory | ||
|
||
# Change working directory to project root | ||
SOURCE=${BASH_SOURCE[0]} | ||
SCRIPT_DIR="$(dirname "$SOURCE")" | ||
PROJECT_ROOT="$SCRIPT_DIR" | ||
cd "$PROJECT_ROOT" || { echo "Could not change directory"; exit 1; } | ||
|
||
source .venv/bin/activate || { echo "ERROR: Failed to activate virtual environment for python"; exit 1; } | ||
|
||
cd src/jukebox || { echo "Could not change directory"; exit 1; } | ||
python run_jukebox.py $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Runner script for pytest to ensure | ||
# - correct config file | ||
# Runner script to ensure | ||
# - correct venv activation | ||
# - independent from working directory | ||
|
||
# Change working directory to location of script | ||
# Change working directory to project root | ||
SOURCE=${BASH_SOURCE[0]} | ||
SCRIPT_DIR="$(dirname "$SOURCE")" | ||
cd "$SCRIPT_DIR" || (echo "Could not change to top-level project directory" && exit 1) | ||
PROJECT_ROOT="$SCRIPT_DIR" | ||
cd "$PROJECT_ROOT" || { echo "Could not change directory"; exit 1; } | ||
|
||
source .venv/bin/activate || { echo "ERROR: Failed to activate virtual environment for python"; exit 1; } | ||
|
||
# Run pytest | ||
pytest -c pytest.ini $@ |
Oops, something went wrong.