]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
ci: fix cloudsmith for python3.5
authorwywywywy <wywywywy@gmail.com>
Mon, 25 Dec 2023 22:35:42 +0000 (22:35 +0000)
committerFlole998 <Flole998@users.noreply.github.com>
Mon, 22 Jan 2024 13:33:53 +0000 (14:33 +0100)
support/cloudsmith.sh

index b59f41318e2a0ac7c6df064699d795c803214508..d759e098d195aa450547f93500b3354ca464afa0 100755 (executable)
@@ -54,9 +54,23 @@ export DEBIAN_FRONTEND=noninteractive
 
 apt install --force-yes -y python3.7 || true
 
-apt install --force-yes -y python3-pip || apt install --force-yes -y python-pip
+# Function to initialize pip using ensurepip and upgrade if necessary
+initialize_pip() {
+    # Use ensurepip to bootstrap pip
+    python3 -m ensurepip
 
-pip3 install --upgrade pip || pip install --upgrade pip || pip2 install --upgrade pip
+    PYTHON_VERSION=$(python3 -c 'import platform; print(platform.python_version())')
+    MAJOR_VERSION=$(echo $PYTHON_VERSION | cut -d. -f1)
+    MINOR_VERSION=$(echo $PYTHON_VERSION | cut -d. -f2)
+
+    if [[ $MAJOR_VERSION -eq 3 ]] && [[ $MINOR_VERSION -ge 6 ]]; then
+        # For Python 3.6 and above, upgrade pip to the latest version
+        python3 -m pip install --upgrade pip
+    fi
+}
+
+# Initialize and upgrade pip
+initialize_pip
 
 pip3 install --upgrade cloudsmith-cli || pip install --upgrade cloudsmith-cli || pip2 install --upgrade cloudsmith-cli