[PATCH] scripts/validate-minimum-dependency-versions: new maintainer script

Thomas De Schampheleire patrickdepinguin at gmail.com
Mon Mar 25 20:41:24 UTC 2019


# HG changeset patch
# User Thomas De Schampheleire <thomas.de_schampheleire at nokia.com>
# Date 1553546343 -3600
#      Mon Mar 25 21:39:03 2019 +0100
# Node ID 3dc609012611ce169b997c40ccad8f4e06fbb792
# Parent  a031ce26b19133ecd5c96e85121656bfd760a78b
scripts/validate-minimum-dependency-versions: new maintainer script

Automate what we can.

This script could be added later to an encompassing script
'prepare-for-release' (which would also do other release-related steps).

diff --git a/scripts/validate-minimum-dependency-versions b/scripts/validate-minimum-dependency-versions
new file mode 100755
--- /dev/null
+++ b/scripts/validate-minimum-dependency-versions
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+# Test that installation of all dependencies works fine if versions are set to
+# the minimum ones.
+
+set -e
+
+if [ -n "$VIRTUAL_ENV" ]; then
+    echo "Please run this script from outside a virtualenv."
+    exit 1
+fi
+
+if ! hg update --check -q .; then
+    echo "Working dir is not clean, please commit/revert changes first."
+    exit 1
+fi
+
+venv=$(mktemp -d kallithea-minimum-dependency-versions-env-XXXXXX)
+log=$(mktemp kallithea-minimum-dependency-versions-log-XXXXXX)
+
+cleanup()
+{
+    echo "Cleaning up..."
+    rm -rf "$venv" "$log"
+    hg revert -a
+}
+trap cleanup EXIT
+
+# Set minimum versions
+sed -i 's/>=/==/' setup.py dev_requirements.txt
+
+virtualenv -p "$(command -v python2)" "$venv"
+source "$venv/bin/activate"
+pip install --upgrade pip setuptools
+
+pip install -e . -r dev_requirements.txt python-ldap python-pam 2>"$log"
+
+# Treat any message on stderr as a problem, for the caller to interpret.
+# This includes the Python 2.7 deprecation message.
+if [ -s "$log" ]; then
+    echo
+    echo "Error: pip detected following problems:"
+    cat "$log"
+    echo
+    exit 1
+fi
+
+echo "Installation successful. Cleaning up..."
+
+cleanup


More information about the kallithea-general mailing list