Initial import to Tizen
[profile/ivi/python-twisted.git] / twisted / topfiles / setup.py
1 #!/usr/bin/env python
2 # Copyright (c) Twisted Matrix Laboratories.
3 # See LICENSE for details.
4
5 """
6 Distutils installer for Twisted.
7 """
8
9 import os
10 import sys
11
12 if sys.version_info < (2, 5):
13     print >>sys.stderr, "You must use at least Python 2.5 for Twisted"
14     sys.exit(3)
15
16 if os.path.exists('twisted'):
17     sys.path.insert(0, '.') # eek! need this to import twisted. sorry.
18 from twisted import copyright
19 from twisted.python.dist import setup, ConditionalExtension as Extension
20 from twisted.python.dist import getPackages, getDataFiles, getScripts
21 from twisted.python.dist import twisted_subprojects, _isCPython, _hasEpoll
22
23
24 extensions = [
25     Extension("twisted.test.raiser",
26               ["twisted/test/raiser.c"],
27               condition=lambda _: _isCPython),
28
29     Extension("twisted.python._epoll",
30               ["twisted/python/_epoll.c"],
31               condition=lambda builder: (_isCPython and _hasEpoll(builder) and
32                                          sys.version_info[:2] < (2, 6))),
33
34     Extension("twisted.internet.iocpreactor.iocpsupport",
35               ["twisted/internet/iocpreactor/iocpsupport/iocpsupport.c",
36                "twisted/internet/iocpreactor/iocpsupport/winsock_pointers.c"],
37               libraries=["ws2_32"],
38               condition=lambda _: _isCPython and sys.platform == "win32"),
39
40     Extension("twisted.python._initgroups",
41               ["twisted/python/_initgroups.c"]),
42     Extension("twisted.python.sendmsg",
43               sources=["twisted/python/sendmsg.c"],
44               condition=lambda _: sys.platform != "win32"),
45     Extension("twisted.internet._sigchld",
46               ["twisted/internet/_sigchld.c"],
47               condition=lambda _: sys.platform != "win32"),
48 ]
49
50 # Figure out which plugins to include: all plugins except subproject ones
51 subProjectsPlugins = ['twisted_%s.py' % subProject
52                       for subProject in twisted_subprojects]
53 plugins = os.listdir(os.path.join(
54     os.path.dirname(os.path.abspath(copyright.__file__)), 'plugins'))
55 plugins = [plugin[:-3] for plugin in plugins if plugin.endswith('.py') and
56            plugin not in subProjectsPlugins]
57
58
59
60 setup_args = dict(
61     # metadata
62     name="Twisted Core",
63     version=copyright.version,
64     description="The core parts of the Twisted networking framework",
65     author="Twisted Matrix Laboratories",
66     author_email="twisted-python@twistedmatrix.com",
67     maintainer="Glyph Lefkowitz",
68     url="http://twistedmatrix.com/",
69     license="MIT",
70     long_description="""\
71 This is the core of Twisted, including:
72  * Networking support (twisted.internet)
73  * Trial, the unit testing framework (twisted.trial)
74  * AMP, the Asynchronous Messaging Protocol (twisted.protocols.amp)
75  * Twisted Spread, a remote object system (twisted.spread)
76  * Utility code (twisted.python)
77  * Basic abstractions that multiple subprojects use
78    (twisted.cred, twisted.application, twisted.plugin)
79  * Database connectivity support (twisted.enterprise)
80  * A few basic protocols and protocol abstractions (twisted.protocols)
81 """,
82
83     # build stuff
84     packages=getPackages('twisted',
85                          ignore=twisted_subprojects + ['plugins']),
86     plugins=plugins,
87     data_files=getDataFiles('twisted', ignore=twisted_subprojects),
88     conditionalExtensions=extensions,
89     scripts = getScripts(""),
90 )
91
92
93 if __name__ == '__main__':
94     setup(**setup_args)