Debian Codegraph @

tests/setup.py.in

raw
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 import os
5 from setuptools import setup, Extension
6
7 build = 'build'
8 srcdir = '@srcdir@'
9 top_builddir = '@top_builddir@'
10 top_srcdir = '@top_srcdir@'
11 libintl = '@LIBINTL@'
12 libiconv = '@LIBICONV@'
13 extra_libs = []
14 extra_libs.extend(libintl.split())
15 extra_libs.extend(libiconv.split())
16
17 # FIXME: On Mingw, Cython seems to call gcc in such a way that it doesn't understand UNIX paths
18 if os.name == 'nt':
19 for i in range(len(extra_libs)):
20 if extra_libs[i][0] == '/':
21 extra_libs[i] = os.popen('cygpath --windows ' + extra_libs[i]).read().rstrip()
22
23 try:
24
25 if srcdir != '.':
26 with open(os.path.join(srcdir, 'Recode.c')) as f:
27 buffer = f.read()
28 with open('Recode.c', 'w') as f:
29 f.write(buffer)
30
31 setup(ext_modules=[
32 Extension('Recode', ['Recode.c'],
33 include_dirs=[top_builddir, os.path.join(top_srcdir, 'src'),
34 os.path.join(top_srcdir, 'lib'),
35 os.path.join(top_builddir, 'lib')],
36 library_dirs=[os.path.join(top_builddir, 'src', '.libs'),
37 os.path.join(top_builddir, 'lib', '.libs')],
38 libraries=['recode', 'gnu'],
39 extra_link_args=extra_libs)
40 ])
41
42 finally:
43
44 if srcdir != '.':
45 if os.path.exists('Recode.c'):
46 os.remove('Recode.c')