From 9d60202d1c9b80163216a01b2057dce23d4c7de8 Mon Sep 17 00:00:00 2001 From: "Dr. Jens Harbott" Date: Sat, 18 Dec 2021 12:47:14 +0100 Subject: [PATCH] Remove extra if/then/else construct in pip element This was introduced in [0] but we can include it in the existing elif series instead. [0] I2b75afd310f009ae8614f6ca75bb984b56d25c45 Change-Id: Ibe05f367be997efbd8c5ebec77503ebd9cda1c8b --- .../04-install-pip | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip b/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip index 8f2fdad3..be816eb7 100755 --- a/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip +++ b/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip @@ -250,29 +250,27 @@ EOF elif [[ $DISTRO_NAME = gentoo ]]; then packages="dev-python/pip dev-python/virtualenv" emerge -U $packages +elif [[ $DIB_RELEASE = bullseye ]]; then + packages="python3-pip python3-virtualenv" + apt-get -y install $packages + install_python3_pip else - if [[ $DIB_RELEASE = bullseye ]]; then - packages="python3-pip python3-virtualenv" - apt-get -y install $packages + # pre-install packages so dependencies are there. We will + # overwrite with latest below. + packages="python-pip python-virtualenv" + + # Unfortunately older ubuntu (trusty) doesn't have a + # python3-virtualenv package -- it seems it wasn't ready at the + # time and you had to use "python -m venv". Since then virtualenv + # has gained 3.4 support so the pip install below will work + if [[ ${DIB_PYTHON_VERSION} == 3 ]]; then + packages+=" python3-pip python3-virtualenv" + fi + + apt-get -y install $packages + + install_python2_pip + if [[ ${DIB_PYTHON_VERSION} == 3 ]]; then install_python3_pip - else - # pre-install packages so dependencies are there. We will - # overwrite with latest below. - packages="python-pip python-virtualenv" - - # Unfortunately older ubuntu (trusty) doesn't have a - # python3-virtualenv package -- it seems it wasn't ready at the - # time and you had to use "python -m venv". Since then virtualenv - # has gained 3.4 support so the pip install below will work - if [[ ${DIB_PYTHON_VERSION} == 3 ]]; then - packages+=" python3-pip python3-virtualenv" - fi - - apt-get -y install $packages - - install_python2_pip - if [[ ${DIB_PYTHON_VERSION} == 3 ]]; then - install_python3_pip - fi fi fi