diff options
author | drebs <drebs@riseup.net> | 2017-11-13 10:52:57 -0200 |
---|---|---|
committer | drebs <drebs@riseup.net> | 2017-11-14 19:01:14 -0200 |
commit | 96899cdf89463b884b16a3c0bc2f5b698c4c221c (patch) | |
tree | 6cad19951061f5d621bc7c220ab99ba915832da1 /scripts/packaging/replace-version-file.py | |
parent | fb47c43f9b869fb65ef0574fcfb5ce042860a5ee (diff) |
[pkg] make debian package report the correct version
The Soledad python source currently makes use of versioneer to calculate
versions dynamically and hardcode versions upon creation of the python
package. Unfortunatlly, this procedure does not behave well with debian
packaging, and we need to manually generate/replace the _version.py file
so the code that ends up in the debian package reports the correct
version of the software.
This commit adds a script to replace the _version.py file with a static
one and rules during packaging to run that script during preparation
stage of debian helper.
Diffstat (limited to 'scripts/packaging/replace-version-file.py')
-rwxr-xr-x | scripts/packaging/replace-version-file.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/packaging/replace-version-file.py b/scripts/packaging/replace-version-file.py new file mode 100755 index 00000000..8c9e046c --- /dev/null +++ b/scripts/packaging/replace-version-file.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +# This script will replace the versioneer source version file configured in +# `setup.cfg` with a file containing the hardcoded version generated by +# versioneer. It is meant to be used before building the debian package, so the +# generated package reports the correct version, as would be generated by +# versioneer if this was a python package. + +import ConfigParser +import versioneer + +# get the path to the version file +config = ConfigParser.RawConfigParser() +config.read('setup.cfg') +source_file = config.get('versioneer', 'versionfile_source') + +# replace version file in source tree +versions = versioneer.get_versions() +versioneer.write_to_version_file(source_file, versions) |