Skip to content

Commit e842b88

Browse files
author
David Sommerseth
committed
Added ethtool.version string constant
This is useful to identify the python-ethtool version at runtime. Signed-off-by: David Sommerseth <davids@redhat.com>
1 parent 2347ee3 commit e842b88

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

python-ethtool/ethtool.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,5 +1058,6 @@ PyMODINIT_FUNC initethtool(void)
10581058
PyModule_AddIntConstant(m, "IFF_DYNAMIC", IFF_DYNAMIC); /* Dialup device with changing addresses. */
10591059
PyModule_AddIntConstant(m, "AF_INET", AF_INET); /* IPv4 interface */
10601060
PyModule_AddIntConstant(m, "AF_INET6", AF_INET6); /* IPv6 interface */
1061+
PyModule_AddStringConstant(m, "version", "python-ethtool v" VERSION);
10611062
}
10621063

setup.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import commands
55
import sys
66

7+
version = '0.6'
8+
79
ethtool = Extension('ethtool',
810
sources = ['python-ethtool/ethtool.c',
911
'python-ethtool/etherinfo.c', 'python-ethtool/etherinfo_obj.c'])
@@ -49,7 +51,7 @@ def _str2list(pkgstr, onlystr):
4951

5052
# don't reformat this line, Makefile parses it
5153
setup(name='ethtool',
52-
version='0.2',
54+
version=version,
5355
description='Python module to interface with ethtool',
5456
author='Harald Hoyer & Arnaldo Carvalho de Melo',
5557
author_email='acme@redhat.com',
@@ -64,7 +66,8 @@ def _str2list(pkgstr, onlystr):
6466
'python-ethtool/etherinfo_ipv6_obj.c'],
6567
include_dirs = libnl['include'],
6668
library_dirs = libnl['libdirs'],
67-
libraries = libnl['libs']
69+
libraries = libnl['libs'],
70+
define_macros = [('VERSION', '"%s"' % version)]
6871
)
6972
]
7073
)

0 commit comments

Comments
 (0)