Use version manually in setup.py when provided (infra) #1253
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
By default we adopt the package version via setuptools scm. This tool reads the SETUPTOOLS_SCM_PRETEND_VERSION environment variable and, if it is provided, it adopts it as the version without doing any further calculation. This is useful to pre-compute the version before building like we do in snaps and debs. This mechanism seems to not be used on some versions of pybuild (the debian plugin we use to build the package) that ignores the setuptools-scm version and simply uses a
0.0.0
version string.This PR adopts the version from the variable in setup.py manually. Note that if the variable is not provided setuptools-scm is still used, preserving the functionality of "source" installs.
Resolved issues
Fixes: https://warthogs.atlassian.net/browse/CHECKBOX-1444
Fixes: #1250
Documentation
This also adds a comment to explain why this is done.
Tests
To try this start a lxd container and build the package:
To verify that all went well run: