5 import distutils
.core
as DC
6 import Cython
.Build
as CB
9 MS
.pkg_config('mLib', '2.4.99~')
11 PYVERSION
= SYS
.version_info
[0:3]
12 pyxc
= 'mLib-py%d.%d.%d.c' % PYVERSION
13 mLib
= DC
.Extension('mLib', [pyxc
,
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
))
22 ## The `cythonize' function generates the C sources immediately, so we have
23 ## to generate its inputs even earlier.
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'})
32 for g
in genfiles
: g
.gen()
34 ## Generate the main C code.
35 if OS
.path
.exists(pyxc
): OS
.rename(pyxc
, "mLib.c")
36 CB
.cythonize("mLib.pyx",
37 compile_time_env
= dict(PYVERSION
= PYVERSION
),
38 compiler_directives
= dict(c_string_encoding
= 'utf8'))
39 OS
.rename("mLib.c", pyxc
)
41 MS
.setup(name
= 'mLib-python',
42 description
= 'Python interface to mLib utilities library',
43 author
= 'Straylight/Edgeware',
44 author_email
= 'mdw@distorted.org.uk',
45 license
= 'GNU General Public License',