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 33import sys
44import setuptools
55
6+ __version__ = '0.0.1'
7+
68
79class get_pybind_include (object ):
810 """Helper class to determine the pybind11 include path
@@ -22,7 +24,7 @@ def __str__(self):
2224ext_modules = [
2325 Extension (
2426 'python_example' ,
25- ['py /main.cpp' ],
27+ ['src /main.cpp' ],
2628 include_dirs = [
2729 # Path to pybind11 headers
2830 get_pybind_include (),
@@ -76,6 +78,7 @@ class BuildExt(build_ext):
7678 def build_extensions (self ):
7779 ct = self .compiler .compiler_type
7880 opts = self .c_opts .get (ct , [])
81+ opts .append ('-DVERSION_INFO="%s"' % self .distribution .get_version ())
7982 if ct == 'unix' :
8083 opts .append (cpp_flag (self .compiler ))
8184 if has_flag (self .compiler , '-fvisibility=hidden' ):
@@ -86,7 +89,7 @@ def build_extensions(self):
8689
8790setup (
8891 name = 'python_example' ,
89- version = '0.0.1' ,
92+ version = __version__ ,
9093 author = 'Sylvain Corlay' ,
9194 author_email = 'sylvain.corlay@gmail.com' ,
9295 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) {
3636 Some other explanation about the subtract function.
3737 )pbdoc" );
3838
39+ #ifdef VERSION_INFO
40+ m.attr (" __version__" ) = py::str (VERSION_INFO);
41+ #else
42+ m.attr (" __version__" ) = py::str (" dev" );
43+ #endif
44+
3945 return m.ptr ();
4046}
You can’t perform that action at this time.
0 commit comments