Skip to content

Commit

Permalink
ENH: Add python wrapper for version extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
MilanSkocic committed Jun 29, 2024
1 parent 41c4a5e commit 0a54a45
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion py/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
library_dirs=library_dirs,
runtime_library_dirs=runtime_library_dirs,
extra_objects=extra_objects)
mod_version = Extension(name=f"py{name:s}.version",
mod_version = Extension(name=f"py{name:s}.version_",
sources=[f"./src/py{name:s}/cpy_{name:s}_version.c"],
libraries=libraries,
library_dirs=library_dirs,
Expand Down
6 changes: 3 additions & 3 deletions py/src/pyiapws/cpy_iapws_version.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
PyDoc_STRVAR(module_docstring, "C extension for iapws version.");

static PyMethodDef myMethods[] = {{ NULL, NULL, 0, NULL }};
static struct PyModuleDef version= {PyModuleDef_HEAD_INIT, "version", module_docstring, -1, myMethods};
static struct PyModuleDef version_ = {PyModuleDef_HEAD_INIT, "version_", module_docstring, -1, myMethods};

PyMODINIT_FUNC PyInit_version(void){
PyMODINIT_FUNC PyInit_version_(void){
PyObject *m;
PyObject *d;
PyObject *v;
m = PyModule_Create(&version);
m = PyModule_Create(&version_);
d = PyModule_GetDict(m);
v = PyUnicode_FromFormat("%s", iapws_get_version());
PyDict_SetItemString(d, "__version__", v);
Expand Down
4 changes: 4 additions & 0 deletions py/src/pyiapws/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""Version."""

"""Version."""
from .version_ import __version__

0 comments on commit 0a54a45

Please sign in to comment.