Skip to content

Commit 390cadc

Browse files
committed
setup: Query library version out of a file
This makes it possible to programatically query the version in any stage of the build process, including Makefile etc. Signed-off-by: Erik Skultety <[email protected]>
1 parent 8c3eb73 commit 390cadc

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

Diff for: MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ include AUTHORS
55
include COPYING
66
include CONTRIBUTING.rst
77
include HACKING
8+
include VERSION
89
include requirements-test.txt
910
include tox.ini
1011
include Makefile

Diff for: VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9.5.0

Diff for: setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = libvirt-python
3-
version = 9.5.0
3+
version = file: VERSION
44
description = The libvirt virtualization API python binding
55
long_description = file: README
66
long_description_content_type = text/x-rst

Diff for: setup.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
from setuptools.command.sdist import sdist
1515

1616

17+
def getVersion():
18+
with open("VERSION") as f:
19+
return f.read().strip()
20+
21+
1722
def check_pkgcfg():
1823
try:
1924
proc = subprocess.run(["pkg-config", "--version"],
@@ -195,7 +200,7 @@ def gen_rpm_spec(self):
195200
return self._gen_from_in("libvirt-python.spec.in",
196201
"libvirt-python.spec",
197202
"@PY_VERSION@",
198-
self.distribution.get_version())
203+
getVersion())
199204

200205
def gen_authors(self):
201206

0 commit comments

Comments
 (0)