Add version fallback for non-dpkg builds
When building directly from setuptools DEBVER is not set so the version becomes 0.0.0. Detect this condition and attempt to extract the version from debian/changelog such that PEP 508 dependency strings can be used to install this package.
This patch was tested with a regular dpkg-buildpackage build to ensure it doesn't interfere. With this patch, PEP 508 [1] style dependencies can be specified in a pyproject.toml and the correct package version will be produced.
For example, with this dependency string
dependencies = [ "python-apt @ git+https://salsa.debian.org/corytodd/python-apt.git@corytodd/version-fallback" ]
pip show python-apt will now report version 2.6.0 instead of 0.0.0.
[1] https://peps.python.org/pep-0508/#specification
Signed-off-by: Cory Todd cory.todd@canonical.com