]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/libucl/python/setup.py
Merge tag 'vendor/NetBSD/vis/20210621' into vis
[FreeBSD/FreeBSD.git] / contrib / libucl / python / setup.py
1 try:
2     from setuptools import setup, Extension
3     # setuptools doesn't support template param for MANIFEST.in
4     from setuptools.command.egg_info import manifest_maker
5     manifest_maker.template = 'python/MANIFEST.in'
6 except ImportError:
7     from distutils.core import setup, Extension
8
9 import os
10 import sys
11
12 LIB_ROOT = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir))  
13 if os.getcwd() != LIB_ROOT:
14     os.chdir(LIB_ROOT)
15 if LIB_ROOT not in sys.path:
16     sys.path.append(LIB_ROOT)
17
18 tests_require = []
19
20 if sys.version < '2.7':
21     tests_require.append('unittest2')
22
23 uclmodule = Extension(
24     'ucl',
25     libraries=['ucl', 'curl'],
26     sources=['python/src/uclmodule.c'],
27     include_dirs=['include'],
28     language='c',
29 )
30
31 ucl_lib = {
32     'sources': ['src/' + fn for fn in os.listdir('src') if fn.endswith('.c')],
33     'include_dirs': ['include', 'src', 'uthash', 'klib'],
34     'macros': [('CURL_FOUND', '1')],
35 }
36
37 # sdist setup() will pull in the *.c files automatically, but not headers
38 # MANIFEST.in will include the headers for sdist only
39 template = 'python/MANIFEST.in'
40
41 # distutils assume setup.py is in the root of the project
42 # we need to include C source from the parent so trick it
43 in_ucl_root = 'setup.py' in os.listdir('python')
44 if in_ucl_root:
45     os.link('python/setup.py', 'setup.py')
46
47 setup(
48     name = 'ucl',
49     version = '0.8.1',
50     description = 'ucl parser and emitter',
51     ext_modules = [uclmodule],
52     template=template, # no longer supported with setuptools but doesn't hurt
53     libraries = [('ucl', ucl_lib)],
54     test_suite = 'tests',
55     tests_require = tests_require,
56     author = "Eitan Adler, Denis Volpato Martins",
57     author_email = "lists@eitanadler.com",
58     url = "https://github.com/vstakhov/libucl/",
59     license = "MIT",
60     classifiers = [
61         "Development Status :: 3 - Alpha",
62         "Intended Audience :: Developers",
63         "License :: DFSG approved",
64         "License :: OSI Approved :: MIT License",
65         "Programming Language :: C",
66         "Programming Language :: Python :: 2",
67         "Programming Language :: Python :: 3",
68         "Programming Language :: Python :: Implementation :: CPython",
69         "Topic :: Software Development :: Libraries",
70     ]
71 )
72
73 # clean up the trick after the build
74 if in_ucl_root:
75     os.unlink("setup.py")