Skip to content

Commit

Permalink
allow breaking system packages
Browse files Browse the repository at this point in the history
  • Loading branch information
s-martin committed Nov 3, 2023
1 parent 84128dd commit ef235d7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 28 deletions.
6 changes: 2 additions & 4 deletions components/gpio_control/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ systemctl stop phoniebox-gpio-buttons.service
systemctl disable phoniebox-gpio-buttons.service

echo 'Install all required python modules'
# Use a venv as Bookworm implemented PEP668 https://stackoverflow.com/a/75696359
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install --upgrade --force-reinstall -r requirements.txt
# Allow breaking system packages (as 2.x is legacy) since Bookworm implemented PEP668 https://stackoverflow.com/a/75696359
python3 -m pip install --upgrade --force-reinstall -r requirements.txt --break-system-packages

echo
echo 'Installing GPIO_Control service'
Expand Down
6 changes: 2 additions & 4 deletions components/rfid-reader/PN532/setup_pn532.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ else
fi

printf "Installing Python requirements for PN532...\n"
# Use a venv as Bookworm implemented PEP668 https://stackoverflow.com/a/75696359
sudo python3 -m venv .venv
source .venv/bin/activate
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${JUKEBOX_HOME_DIR}"/components/rfid-reader/PN532/requirements.txt
# Allow breaking system packages (as 2.x is legacy) since Bookworm implemented PEP668 https://stackoverflow.com/a/75696359
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${JUKEBOX_HOME_DIR}"/components/rfid-reader/PN532/requirements.txt --break-system-packages

printf "Configure RFID reader in Phoniebox...\n"
cp "${JUKEBOX_HOME_DIR}"/scripts/Reader.py.experimental "${JUKEBOX_HOME_DIR}"/scripts/Reader.py
Expand Down
6 changes: 2 additions & 4 deletions components/rfid-reader/RC522/setup_rc522.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ printf "Please make sure that the RC522 reader is wired up correctly to the GPIO
question "Continue"

printf "Installing Python requirements for RC522...\n"
# Use a venv as Bookworm implemented PEP668 https://stackoverflow.com/a/75696359
sudo python3 -m venv .venv
source .venv/bin/activate
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${JUKEBOX_HOME_DIR}"/components/rfid-reader/RC522/requirements.txt
# Allow breaking system packages (as 2.x is legacy) since Bookworm implemented PEP668 https://stackoverflow.com/a/75696359
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${JUKEBOX_HOME_DIR}"/components/rfid-reader/RC522/requirements.txt --break-system-packages

printf "Activating SPI...\n"
sudo raspi-config nonint do_spi 0
Expand Down
8 changes: 4 additions & 4 deletions scripts/RegisterDevice.py.Multi
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ def setupPN532():
print(str(output))
return False
print("Installing Python requirements for PN532...\n")
# Use a venv as Bookworm implemented PEP668 https://stackoverflow.com/a/75696359
# Allow breaking system packages (as 2.x is legacy) since Bookworm implemented PEP668 https://stackoverflow.com/a/75696359
runCmd("sudo python3 -m venv .venv")
runCmd("source .venv/bin/activate")
runCmd("sudo python3 -m pip install --upgrade --force-reinstall "
"-q -r {}/components/rfid-reader/PN532/requirements.txt".format(JUKEBOX_HOME_DIR))
"-q -r {}/components/rfid-reader/PN532/requirements.txt --break-system-packages".format(JUKEBOX_HOME_DIR))
print("Done")
return True

Expand All @@ -47,11 +47,11 @@ def setupMFRC522():
if not answer or answer[0] != 'Y':
return False
print("Installing Python requirements for RC522...\n")
# Use a venv as Bookworm implemented PEP668 https://stackoverflow.com/a/75696359
# Allow breaking system packages (as 2.x is legacy) since Bookworm implemented PEP668 https://stackoverflow.com/a/75696359
runCmd("sudo python3 -m venv .venv")
runCmd("source .venv/bin/activate")
runCmd("sudo python3 -m pip install --upgrade --force-reinstall "
"-q -r {}/components/rfid-reader/RC522/requirements.txt".format(JUKEBOX_HOME_DIR))
"-q -r {}/components/rfid-reader/RC522/requirements.txt --break-system-packages".format(JUKEBOX_HOME_DIR))
print("Done")
return True

Expand Down
18 changes: 6 additions & 12 deletions scripts/installscripts/buster-install-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -872,18 +872,14 @@ install_main() {
${apt_get} ${allow_downgrades} install libspotify12 python3-cffi python3-ply python3-pycparser python3-spotify

# Install necessary Python packages
# Use a venv as Bookworm implemented PEP668 https://stackoverflow.com/a/75696359
sudo python3 -m venv .venv
source .venv/bin/activate
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${jukebox_dir}"/requirements-spotify.txt
# Allow breaking system packages (as 2.x is legacy) since Bookworm implemented PEP668 https://stackoverflow.com/a/75696359
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${jukebox_dir}"/requirements-spotify.txt --break-system-packages
fi

# Install more required packages
echo "Installing additional Python packages..."
# Use a venv as Bookworm implemented PEP668 https://stackoverflow.com/a/75696359
sudo python3 -m venv .venv
source .venv/bin/activate
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${jukebox_dir}"/requirements.txt
# Allow breaking system packages (as 2.x is legacy) since Bookworm implemented PEP668 https://stackoverflow.com/a/75696359
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${jukebox_dir}"/requirements.txt --break-system-packages

samba_config

Expand Down Expand Up @@ -1017,10 +1013,8 @@ install_main() {

# GPIO-Control
if [[ "${GPIOconfig}" == "YES" ]]; then
# Use a venv as Bookworm implemented PEP668 https://stackoverflow.com/a/75696359
sudo python3 -m venv .venv
source .venv/bin/activate
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${jukebox_dir}"/requirements-GPIO.txt
# Allow breaking system packages (as 2.x is legacy) since Bookworm implemented PEP668 https://stackoverflow.com/a/75696359
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${jukebox_dir}"/requirements-GPIO.txt --break-system-packages
sudo systemctl enable phoniebox-gpio-control.service
if [[ ! -f "${jukebox_dir}"/settings/gpio_settings.ini ]]; then
cp "${jukebox_dir}"/misc/sampleconfigs/gpio_settings.ini.sample "${jukebox_dir}"/settings/gpio_settings.ini
Expand Down

0 comments on commit ef235d7

Please sign in to comment.