Skip to content

Commit

Permalink
set break system packages globally
Browse files Browse the repository at this point in the history
  • Loading branch information
s-martin committed Nov 6, 2023
1 parent 0b40404 commit 9569d5d
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 15 deletions.
3 changes: 1 addition & 2 deletions components/gpio_control/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ systemctl stop phoniebox-gpio-buttons.service
systemctl disable phoniebox-gpio-buttons.service

echo 'Install all required python modules'
echo "WARNING: When using Bookworm, uncomment breaking system packages in line 20 of install.sh as Bookworm implemented PEP668 https://stackoverflow.com/a/75696359"
python3 -m pip install --upgrade --force-reinstall -r requirements.txt #--break-system-packages
python3 -m pip install --upgrade --force-reinstall -r requirements.txt

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

printf "Installing Python requirements for PN532...\n"
echo "WARNING: When using Bookworm, uncomment breaking system packages in line 37 of setup_pn532.sh as 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
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${JUKEBOX_HOME_DIR}"/components/rfid-reader/PN532/requirements.txt

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

printf "Installing Python requirements for RC522...\n"
echo "WARNING: When using Bookworm, uncomment breaking system packages in line 21 of setup_rc522.sh as 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
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${JUKEBOX_HOME_DIR}"/components/rfid-reader/RC522/requirements.txt

printf "Activating SPI...\n"
sudo raspi-config nonint do_spi 0
Expand Down
2 changes: 0 additions & 2 deletions scripts/RegisterDevice.py.Multi
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def setupPN532():
print(str(output))
return False
print("Installing Python requirements for PN532...\n")
print("WARNING: When using Bookworm, add --break-system-packages in line 37 of RegisterDevice.py.Multi as Bookworm implemented PEP668 https://stackoverflow.com/a/75696359")
runCmd("sudo python3 -m pip install --upgrade --force-reinstall "
"-q -r {}/components/rfid-reader/PN532/requirements.txt".format(JUKEBOX_HOME_DIR))
print("Done")
Expand All @@ -45,7 +44,6 @@ def setupMFRC522():
if not answer or answer[0] != 'Y':
return False
print("Installing Python requirements for RC522...\n")
print("WARNING: When using Bookworm, add --break-system-packages in line 50 of RegisterDevice.py.Multi as Bookworm implemented PEP668 https://stackoverflow.com/a/75696359")
runCmd("sudo python3 -m pip install --upgrade --force-reinstall "
"-q -r {}/components/rfid-reader/RC522/requirements.txt".format(JUKEBOX_HOME_DIR))
print("Done")
Expand Down
9 changes: 2 additions & 7 deletions scripts/installscripts/buster-install-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -840,13 +840,6 @@ install_main() {
local allow_downgrades="--allow-downgrades --allow-remove-essential --allow-change-held-packages"
local pip_install="sudo python3 -m pip install --upgrade --force-reinstall -q"

if [[ "${OS_CODENAME}" == "bookworm" ]]; then
# Allow breaking system packages (as 2.x is legacy) since Bookworm implemented PEP 668 https://stackoverflow.com/a/75696359
# this switch exists only under bookworm
echo "Allowing --break-system-packages under bookworm for PEP 668"
pip_install="${pip_install} --break-system-packages"
fi

clear

echo "#####################################################
Expand Down Expand Up @@ -926,6 +919,8 @@ install_main() {

# use python3 as default
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
# make compatible for Bookworm, which implements PEP 668
sudo python3 -m pip config set global.break-system-packages true

# Get github code
cd "${HOME_DIR}" || exit
Expand Down

0 comments on commit 9569d5d

Please sign in to comment.