setup.py (242b24828472137ec4411826b86e753d49bd2c39) setup.py (a0409676120c1e558d0ade943019934e0f15118d)
1try:
2 from setuptools import setup, Extension
1try:
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'
3except ImportError:
4 from distutils.core import setup, Extension
5
6import os
7import sys
8
6except ImportError:
7 from distutils.core import setup, Extension
8
9import os
10import sys
11
12LIB_ROOT = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir))
13if os.getcwd() != LIB_ROOT:
14 os.chdir(LIB_ROOT)
15if LIB_ROOT not in sys.path:
16 sys.path.append(LIB_ROOT)
17
9tests_require = []
10
11if sys.version < '2.7':
12 tests_require.append('unittest2')
13
14uclmodule = Extension(
15 'ucl',
18tests_require = []
19
20if sys.version < '2.7':
21 tests_require.append('unittest2')
22
23uclmodule = Extension(
24 'ucl',
16 libraries = ['ucl'],
17 sources = ['src/uclmodule.c'],
18 language = 'c'
25 libraries=['ucl', 'curl'],
26 sources=['python/src/uclmodule.c'],
27 include_dirs=['include'],
28 language='c',
19)
20
29)
30
31ucl_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
39template = '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
43in_ucl_root = 'setup.py' in os.listdir('python')
44if in_ucl_root:
45 os.link('python/setup.py', 'setup.py')
46
21setup(
22 name = 'ucl',
47setup(
48 name = 'ucl',
23 version = '0.8',
24 description = 'ucl parser and emmitter',
49 version = '0.8.1',
50 description = 'ucl parser and emitter',
25 ext_modules = [uclmodule],
51 ext_modules = [uclmodule],
52 template=template, # no longer supported with setuptools but doesn't hurt
53 libraries = [('ucl', ucl_lib)],
26 test_suite = 'tests',
27 tests_require = tests_require,
28 author = "Eitan Adler, Denis Volpato Martins",
29 author_email = "lists@eitanadler.com",
30 url = "https://github.com/vstakhov/libucl/",
31 license = "MIT",
32 classifiers = [
33 "Development Status :: 3 - Alpha",
34 "Intended Audience :: Developers",
35 "License :: DFSG approved",
36 "License :: OSI Approved :: MIT License",
37 "Programming Language :: C",
38 "Programming Language :: Python :: 2",
39 "Programming Language :: Python :: 3",
40 "Programming Language :: Python :: Implementation :: CPython",
41 "Topic :: Software Development :: Libraries",
42 ]
43)
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
74if in_ucl_root:
75 os.unlink("setup.py")