File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 3
3
import sys
4
4
import setuptools
5
5
6
+ __version__ = '0.0.1'
7
+
6
8
7
9
class get_pybind_include (object ):
8
10
"""Helper class to determine the pybind11 include path
@@ -22,7 +24,7 @@ def __str__(self):
22
24
ext_modules = [
23
25
Extension (
24
26
'python_example' ,
25
- ['py /main.cpp' ],
27
+ ['src /main.cpp' ],
26
28
include_dirs = [
27
29
# Path to pybind11 headers
28
30
get_pybind_include (),
@@ -76,6 +78,7 @@ class BuildExt(build_ext):
76
78
def build_extensions (self ):
77
79
ct = self .compiler .compiler_type
78
80
opts = self .c_opts .get (ct , [])
81
+ opts .append ('-DVERSION_INFO="%s"' % self .distribution .get_version ())
79
82
if ct == 'unix' :
80
83
opts .append (cpp_flag (self .compiler ))
81
84
if has_flag (self .compiler , '-fvisibility=hidden' ):
@@ -86,7 +89,7 @@ def build_extensions(self):
86
89
87
90
setup (
88
91
name = 'python_example' ,
89
- version = '0.0.1' ,
92
+ version = __version__ ,
90
93
author = 'Sylvain Corlay' ,
91
94
author_email = 'sylvain.corlay@gmail.com' ,
92
95
url = 'https://github.com/pybind/python_example' ,
Original file line number Diff line number Diff line change @@ -36,5 +36,11 @@ PYBIND11_PLUGIN(python_example) {
36
36
Some other explanation about the subtract function.
37
37
)pbdoc" );
38
38
39
+ #ifdef VERSION_INFO
40
+ m.attr (" __version__" ) = py::str (VERSION_INFO);
41
+ #else
42
+ m.attr (" __version__" ) = py::str (" dev" );
43
+ #endif
44
+
39
45
return m.ptr ();
40
46
}
You can’t perform that action at this time.
0 commit comments