ansible-builder reporting a wrong version "0.0.0"
Hi all, I have packaged a lot of the ansible-* tools recently. I could get all of them to properly report the correct version number when being called with "--version". The only one that gave me some more headache was ansible-builder. Unlike with ansible-lint or ansible-sign, where there was a simple version statement in the python files in /usr/lib/python3.10/... that needed adapting, this uses importlib-metadata to get the version:
https://github.com/ansible/ansible-builder/blob/devel/src/ansible_builder/cl...
I completely replace that line with just 'version = "3.0.0"' and it reported the proper version. What would be the right way to solve this? Is this something that is done during building with tox, as upstream does? As I am not using tox to build the package, maybe the "tox -e version" step from the Makefile is missing and needs to be implemented? dist/$(NAME)-$(VERSION).tar.gz: tox -e version $(DIST_PYTHON) setup.py sdist What would be the right way? Kind Regards, Johannes -- Johannes Kastl Linux Consultant & Trainer Tel.: +49 (0) 151 2372 5802 Mail: kastl@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg http://www.b1-systems.de GF: Ralph Dehner Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
Hi Johannes, Am 18.05.23 um 10:33 schrieb Johannes Kastl:
Hi all,
I have packaged a lot of the ansible-* tools recently. I could get all of them to properly report the correct version number when being called with "--version". The only one that gave me some more headache was ansible-builder.
Unlike with ansible-lint or ansible-sign, where there was a simple version statement in the python files in /usr/lib/python3.10/... that needed adapting, this uses importlib-metadata to get the version:
https://github.com/ansible/ansible-builder/blob/devel/src/ansible_builder/cl...
[...]
What would be the right way?
You are missing setuptools-scm or are using a setuptools-scm version which does not come with TOML support automatically (on Leap, Tumbleweed should have it): https://github.com/ansible/ansible-builder/blob/d414c7232defe4a9647bcfa522c3... Add the python module to the BuildRequires. Also, you can see the problem in the fact that it installed ansible_builder-0.0.0.dist-info into the sitelib. This is discouraged: %files %{ansible_python_sitelib}/ansible_builder-*-info Use %{ansible_python_sitelib}/ansible_builder-%{version}.dist-info in order to detect such mistakes.
Kind Regards, Johannes
- Ben
On 18.05.23 at 10:44 Ben Greiner wrote:
Am 18.05.23 um 10:33 schrieb Johannes Kastl:
[python module not reporting the right version]
What would be the right way?
You are missing setuptools-scm or are using a setuptools-scm version which does not come with TOML support automatically (on Leap, Tumbleweed should have it):
https://github.com/ansible/ansible-builder/blob/d414c7232defe4a9647bcfa522c3...
Add the python module to the BuildRequires.
Will do so, thanks!
Also, you can see the problem in the fact that it installed ansible_builder-0.0.0.dist-info into the sitelib.
This is discouraged:
%files %{ansible_python_sitelib}/ansible_builder-*-info
Use
%{ansible_python_sitelib}/ansible_builder-%{version}.dist-info
in order to detect such mistakes. And again I learned another thing about python packaging. Thanks Ben for the education! Will keep that information at hand.
Have a nice one, Johannes -- Johannes Kastl Linux Consultant & Trainer Tel.: +49 (0) 151 2372 5802 Mail: kastl@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg http://www.b1-systems.de GF: Ralph Dehner Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
participants (2)
-
Ben Greiner
-
Johannes Kastl