@@@ cython and python3
[mLib-python] / setup.py
CommitLineData
a510e264
MW
1#! /usr/bin/python
2
efb0bf0e
MW
3import os as OS
4import sys as SYS
a510e264 5import distutils.core as DC
efb0bf0e 6import Cython.Build as CB
a510e264
MW
7import mdwsetup as MS
8
efb0bf0e 9MS.pkg_config('mLib', '2.4.99~')
a510e264 10
efb0bf0e
MW
11PYVERSION = SYS.version_info[0:3]
12pyxc = 'mLib-py%d.%d.%d.c' % PYVERSION
13mLib = DC.Extension('mLib', [pyxc,
14 'atom-base.c',
15 ##'array.c'
16 ],
a510e264
MW
17 ##extra_compile_args = ['-O0'],
18 include_dirs = MS.uniquify(MS.INCLUDEDIRS),
19 library_dirs = MS.uniquify(MS.LIBDIRS),
20 libraries = MS.uniquify(MS.LIBS))
21
efb0bf0e
MW
22## The `cythonize' function generates the C sources immediately, so we have
23## to generate its inputs even earlier.
24genfiles = [
25# MS.Derive('base64.pyx', 'codec.pyx.in',
26# {'CLASS': 'Base64', 'PREFIX': 'base64'}),
27# MS.Derive('base32.pyx', 'codec.pyx.in',
28# {'CLASS': 'Base32', 'PREFIX': 'base32'}),
29# MS.Derive('hex.pyx', 'codec.pyx.in',
30# {'CLASS': 'Hex', 'PREFIX': 'hex'})
31]
32for g in genfiles: g.gen()
33
34## Generate the main C code.
35if OS.path.exists(pyxc): OS.rename(pyxc, "mLib.c")
36CB.cythonize("mLib.pyx", compile_time_env = dict(PYVERSION = PYVERSION))
37OS.rename("mLib.c", pyxc)
38
976d8e49 39MS.setup(name = 'mLib-python',
a510e264
MW
40 description = 'Python interface to mLib utilities library',
41 author = 'Straylight/Edgeware',
42 author_email = 'mdw@distorted.org.uk',
43 license = 'GNU General Public License',
44 ext_modules = [mLib],
efb0bf0e
MW
45 genfiles = genfiles,
46 cleanfiles = [pyxc])