Skip to content

Commit cd18418

Browse files
committed
Merge branch 'dev', added Python 3 support.
2 parents 38076fe + a39a6ab commit cd18418

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

mapcodemodule.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,26 @@ static PyMethodDef mapcode_methods[] = {
151151
};
152152

153153
/* Initialisation that gets called when module is imported. */
154+
#if PY_MAJOR_VERSION >= 3
155+
PyMODINIT_FUNC PyInit_mapcode(void)
156+
{
157+
static struct PyModuleDef mapcode_module = {
158+
PyModuleDef_HEAD_INIT,
159+
"mapcode", /* m_name */
160+
mapcode_doc, /* m_doc */
161+
-1, /* m_size */
162+
mapcode_methods, /* m_methods */
163+
NULL, /* m_reload */
164+
NULL, /* m_traverse */
165+
NULL, /* m_clear */
166+
NULL, /* m_free */
167+
};
168+
169+
return(PyModule_Create(&mapcode_module));
170+
}
171+
#else
154172
PyMODINIT_FUNC initmapcode(void)
155173
{
156174
Py_InitModule3("mapcode", mapcode_methods, mapcode_doc);
157175
}
176+
#endif

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@
33

44
from distutils.core import setup, Extension
55

6+
module_version = '2.0.0.2'
67

78
setup(
89
name='mapcode',
910
ext_modules=[Extension('mapcode',
1011
sources=['mapcodemodule.c', 'mapcodelib/mapcoder.c'],
1112
include_dirs=['mapcodelib']
1213
)],
13-
version='2.0.0.0',
14+
version=module_version,
1415
description='A Python module to do mapcode encoding and decoding. See http://www.mapcode.com for more information.',
1516
author='Erik Bos',
1617
author_email='erik@xs4all.nl',
1718
url='https://github.com/mapcode-foundation/mapcode-python',
18-
download_url='https://github.com/mapcode-foundation/mapcode-python/tarball/v2.0.0.1',
19+
download_url='https://github.com/mapcode-foundation/mapcode-python/tarball/v' + module_version,
1920
license='Apache License 2.0',
2021
classifiers=[
2122
'Development Status :: 5 - Production/Stable',

0 commit comments

Comments
 (0)