From f933194813de9d18b89040fa8c5b80bcd0dd967c Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Tue, 22 Nov 2022 18:10:01 +0100 Subject: [PATCH] Update self version fetching mechanism With release of new setuptools running setup.py --version started returining extra line. Eventually, running setup.py as a script is not considered as good practice and we should not rely on it's output much. Instead, we can leverage importlib.metadata as it should be more reliable in long run. Closes-Bug: #1997365 Change-Id: Ife227db4ad25851456e1acc6b4daf198f39d989a --- scripts/bootstrap-ansible.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bootstrap-ansible.sh b/scripts/bootstrap-ansible.sh index f0738d3048..7e48aaf785 100755 --- a/scripts/bootstrap-ansible.sh +++ b/scripts/bootstrap-ansible.sh @@ -156,7 +156,7 @@ if [ "${SETUP_ARA}" == "true" ]; then fi # Get current code version (this runs at the root of OSA clone) -export CURRENT_OSA_VERSION=$(cd ${OSA_CLONE_DIR}; /opt/ansible-runtime/bin/python setup.py --version) +export CURRENT_OSA_VERSION=$(cd ${OSA_CLONE_DIR}; /opt/ansible-runtime/bin/python -c "from importlib.metadata import version; print(version('openstack-ansible'))") # Ensure that Ansible binaries run from the venv pushd /opt/ansible-runtime/bin