@@@ cython and python3
[mLib-python] / setup.py
1 #! /usr/bin/python
2
3 import os as OS
4 import sys as SYS
5 import distutils.core as DC
6 import Cython.Build as CB
7 import mdwsetup as MS
8
9 MS.pkg_config('mLib', '2.4.99~')
10
11 PYVERSION = SYS.version_info[0:3]
12 pyxc = 'mLib-py%d.%d.%d.c' % PYVERSION
13 mLib = DC.Extension('mLib', [pyxc,
14 'atom-base.c',
15 ##'array.c'
16 ],
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
22 ## The `cythonize' function generates the C sources immediately, so we have
23 ## to generate its inputs even earlier.
24 genfiles = [
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 ]
32 for g in genfiles: g.gen()
33
34 ## Generate the main C code.
35 if OS.path.exists(pyxc): OS.rename(pyxc, "mLib.c")
36 CB.cythonize("mLib.pyx", compile_time_env = dict(PYVERSION = PYVERSION))
37 OS.rename("mLib.c", pyxc)
38
39 MS.setup(name = 'mLib-python',
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],
45 genfiles = genfiles,
46 cleanfiles = [pyxc])