A tool/command is used to generate a version.py module with the version number. However, this doesn't work well with launchpad recipes because the ability to run arbitrary commands in a recipe is disabled in launchpad.
You can, of course, do that at build time, rather that at source-package-creation time.
version.py
:
# Overwritten during Debian packaging buildpackage_version="unknown"
debian/rules
:
override_dh_auto_build: dpkg-parsechangelog | sed -rne 's,^Version: (.*),package_version="\1", p'> version.py dh_auto_build
debian/clean
:
version.py