From 971ba7cb3c0c16167acd26ad580235005708c40e Mon Sep 17 00:00:00 2001
From: George Sedov <george.sedov@desy.de>
Date: Thu, 14 Oct 2021 17:32:06 +0200
Subject: [PATCH] Add special case for pip version, which shouldn't have
 leading zeroes

---
 docs/site/freeze_version.sh                                 | 6 ++++++
 .../version-21.09.0/install_python_clients_pip.sh           | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/docs/site/freeze_version.sh b/docs/site/freeze_version.sh
index 2ed506ca6..1e88279cb 100755
--- a/docs/site/freeze_version.sh
+++ b/docs/site/freeze_version.sh
@@ -13,6 +13,11 @@ npm run docusaurus docs:version $DOCS_VERSION
 VERSIONED_EXAMPLES="versioned_examples/version-$DOCS_VERSION"
 VERSIONED_EXAMPLES_ESCAPED="versioned_examples\\/version-$DOCS_VERSION"
 
+# special case for pip version, which should not contain leading zeroes
+VERSION_FOR_PIP=$DOCS_VERSION
+# remove the leading zero in the version, if present
+[[ $VERSION_FOR_PIP =~ (.+)\.(0.+) ]] && VERSION_FOR_PIP="${BASH_REMATCH[1]}.${BASH_REMATCH[2]:1}"
+
 mkdir $VERSIONED_EXAMPLES
 
 cp -r examples/* $VERSIONED_EXAMPLES
@@ -33,6 +38,7 @@ for file in $(find ./${VERSIONED_EXAMPLES} -type f)
 do
 ed -s $file <<ED_COMMANDS > /dev/null 2>&1
 ,s/asapo-cluster-dev:100\.0\.develop/asapo-cluster:${DOCS_VERSION}/g
+,s/==100\.0\.develop/==${VERSION_FOR_PIP}/g
 ,s/100\.0[~.]develop/${DOCS_VERSION}/g
 w
 ED_COMMANDS
diff --git a/docs/site/versioned_examples/version-21.09.0/install_python_clients_pip.sh b/docs/site/versioned_examples/version-21.09.0/install_python_clients_pip.sh
index 5add21beb..2d0bfbc29 100644
--- a/docs/site/versioned_examples/version-21.09.0/install_python_clients_pip.sh
+++ b/docs/site/versioned_examples/version-21.09.0/install_python_clients_pip.sh
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash
 
-pip3 install --user --trusted-host nims.desy.de --find-links=http://nims.desy.de/extra/asapo/linux_wheels asapo_producer==21.09.0
-pip3 install --user --trusted-host nims.desy.de --find-links=http://nims.desy.de/extra/asapo/linux_wheels asapo_consumer==21.09.0
+pip3 install --user --trusted-host nims.desy.de --find-links=http://nims.desy.de/extra/asapo/linux_wheels asapo_producer==21.9.0
+pip3 install --user --trusted-host nims.desy.de --find-links=http://nims.desy.de/extra/asapo/linux_wheels asapo_consumer==21.9.0
 # you might need to update pip if the above commands error: pip3 install --upgrade pip
 
 # if that does not work (abi incompatibility, etc) you may try to install source packages
-- 
GitLab