Added murmur3.__version__
This commit is contained in:
parent
d5f4dc9d3f
commit
19306a118f
3 changed files with 19 additions and 6 deletions
17
module.cpp
17
module.cpp
|
|
@ -1,5 +1,6 @@
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
#include "MurmurHash3.h"
|
#include "MurmurHash3.h"
|
||||||
|
#include "version.py"
|
||||||
|
|
||||||
static PyObject *hash32(PyObject *, PyObject *);
|
static PyObject *hash32(PyObject *, PyObject *);
|
||||||
static PyObject *hash128(PyObject *, PyObject *);
|
static PyObject *hash128(PyObject *, PyObject *);
|
||||||
|
|
@ -145,12 +146,16 @@ static PyObject *hash128_64(PyObject *self, PyObject *args)
|
||||||
#if PY_MAJOR_VERSION <= 2
|
#if PY_MAJOR_VERSION <= 2
|
||||||
/* Python 1.x/2.x */
|
/* Python 1.x/2.x */
|
||||||
|
|
||||||
extern "C"
|
extern "C" PyMODINIT_FUNC
|
||||||
PyMODINIT_FUNC
|
|
||||||
initmurmur3(void)
|
initmurmur3(void)
|
||||||
{
|
{
|
||||||
//Py_Initialize();
|
//Py_Initialize();
|
||||||
(void) Py_InitModule3("murmur3", methods, (char *)documentation);
|
PyObject *module;
|
||||||
|
|
||||||
|
module = Py_InitModule3("murmur3", methods, (char *)documentation);
|
||||||
|
if (!module) return;
|
||||||
|
|
||||||
|
PyModule_AddStringConstant(module, "__version__", MODULE_VERSION);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* Python 3.x */
|
/* Python 3.x */
|
||||||
|
|
@ -167,13 +172,15 @@ static PyObject *hash128_64(PyObject *self, PyObject *args)
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C"
|
extern "C" PyMODINIT_FUNC
|
||||||
PyMODINIT_FUNC
|
|
||||||
PyInit_murmur3(void)
|
PyInit_murmur3(void)
|
||||||
{
|
{
|
||||||
PyObject *module;
|
PyObject *module;
|
||||||
|
|
||||||
module = PyModule_Create(&murmur3_module);
|
module = PyModule_Create(&murmur3_module);
|
||||||
|
if (!module) return module;
|
||||||
|
PyModule_AddStringConstant(module, "__version__", MODULE_VERSION);
|
||||||
|
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
3
setup.py
3
setup.py
|
|
@ -1,8 +1,9 @@
|
||||||
from distutils.core import setup, Extension
|
from distutils.core import setup, Extension
|
||||||
|
import version
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = 'murmur3',
|
name = 'murmur3',
|
||||||
version = '0.2',
|
version = version.MODULE_VERSION,
|
||||||
ext_modules = [
|
ext_modules = [
|
||||||
Extension('murmur3', ['module.cpp', 'MurmurHash3.cpp'],),
|
Extension('murmur3', ['module.cpp', 'MurmurHash3.cpp'],),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
5
version.py
Normal file
5
version.py
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
#ifndef __FILE__
|
||||||
|
MODULE_VERSION = "0.2.0"
|
||||||
|
#else
|
||||||
|
#define MODULE_VERSION "0.2.0"
|
||||||
|
#endif
|
||||||
Loading…
Add table
Add a link
Reference in a new issue