From 1637b4231c14c4d8488560a0f5e5b770f07e7601 Mon Sep 17 00:00:00 2001 From: pieterhelsen Date: Sun, 23 May 2021 12:05:00 +0200 Subject: [PATCH] Add install check for libpython3-dev and build-essential --- install.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/install.sh b/install.sh index 2ddc178..8cb23b9 100755 --- a/install.sh +++ b/install.sh @@ -1,3 +1,8 @@ +# Function that checks if a package is installed locally +function package_installed() { + return dpkg -l "$1" &> /dev/null +} + # Check Python version if ! python3 -c 'import sys; assert sys.version_info >= (3,7)' 2> /dev/null; then @@ -6,6 +11,12 @@ then exit 1 fi +# Check existence of required python build packages +if ! package_installed libpython3-dev || ! package_installed build-essential; then + sudo apt-get update + sudo apt-get install libpython3-dev build-essential -y +fi + # Create virtual environment python3 -m venv venv