/
setup.py
164 lines (142 loc) · 5.69 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/usr/bin/env python
#
# Copyright (c) 2008-2010 by Enthought, Inc.
# All rights reserved.
"""
Explicitly typed attributes for Python.
The Traits project is at the center of all Enthought Tool Suite development
and has changed the mental model used at Enthought for programming in the
already extremely efficient Python programming language. We encourage everyone
to join us in enjoying the productivity gains from using such a powerful
approach.
The Traits project allows Python programmers to use a special kind of type
definition called a *trait*, which gives object attributes some additional
characteristics:
- **Initialization**: A trait has a *default value*, which is
automatically set as the initial value of an attribute before its
first use in a program.
- **Validation**: A trait attribute's type is *explicitly declared*. The
type is evident in the code, and only values that meet a
programmer-specified set of criteria (i.e., the trait definition) can
be assigned to that attribute.
- **Delegation**: The value of a trait attribute can be contained either
in the defining object or in another object *delegated* to by the
trait.
- **Notification**: Setting the value of a trait attribute can *notify*
other parts of the program that the value has changed.
- **Visualization**: User interfaces that allow a user to *interactively
modify* the value of a trait attribute can be automatically
constructed using the trait's definition. (This feature requires that
a supported GUI toolkit be installed. If this feature is not used, the
Traits project does not otherwise require GUI support.)
A class can freely mix trait-based attributes with normal Python attributes,
or can opt to allow the use of only a fixed or open set of trait attributes
within the class. Trait attributes defined by a classs are automatically
inherited by any subclass derived from the class.
Prerequisites
-------------
You must have the following libraries installed before building or installing
Traits:
* `Numpy <http://pypi.python.org/pypi/numpy/1.1.1>`_ to support the trait types
for arrays. Version 1.1.0 or later is preferred. Version 1.0.4 will work, but
some tests may fail.
* `setuptools <http://pypi.python.org/pypi/setuptools/0.6c8>`_
*-`setupdocs <http://pypi.python.org/pypi/SetupDocs>`_"""
import traceback
import sys
from setuptools import setup, Extension, find_packages
from setuptools.command.develop import develop
from distutils.command.build import build as distbuild
from distutils import log
# FIXME: This works around a setuptools bug which gets setup_data.py metadata
# from incorrect packages. Ticket #1592
#from setup_data import INFO
setup_data = dict(__name__='', __file__='setup_data.py')
execfile('setup_data.py', setup_data)
INFO = setup_data['INFO']
ctraits = Extension(
'enthought.traits.ctraits',
sources = ['enthought/traits/ctraits.c'],
extra_compile_args = ['-DNDEBUG=1', '-O3'],
)
speedups = Extension(
'enthought.traits.protocols._speedups',
# fixme: Use the generated sources until Pyrex 0.9.6 and setuptools can play
# with each other. See #1364
sources = ['enthought/traits/protocols/_speedups.c'],
extra_compile_args = ['-DNDEBUG=1', '-O3'],
)
# Pull the description values for the setup keywords from our file docstring.
DOCLINES = __doc__.split("\n")
class MyDevelop(develop):
def run(self):
develop.run(self)
try:
self.run_command('build_docs')
except:
log.warn("Couldn't build documentation:\n%s" %
traceback.format_exception(*sys.exc_info()))
class MyBuild(distbuild):
def run(self):
distbuild.run(self)
try:
self.run_command('build_docs')
except:
log.warn("Couldn't build documentation:\n%s" %
traceback.format_exception(*sys.exc_info()))
setup(
author = 'David C. Morrill, et. al.',
author_email = 'dmorrill@enthought.com',
classifiers = [c.strip() for c in """\
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
Intended Audience :: Science/Research
License :: OSI Approved :: BSD License
Operating System :: MacOS
Operating System :: Microsoft :: Windows
Operating System :: OS Independent
Operating System :: POSIX
Operating System :: Unix
Programming Language :: C
Programming Language :: Python
Topic :: Scientific/Engineering
Topic :: Software Development
Topic :: Software Development :: Libraries
""".splitlines() if len(c.strip()) > 0],
cmdclass = {
'develop': MyDevelop,
'build': MyBuild
},
description = DOCLINES[1],
download_url = ('http://www.enthought.com/repo/ETS/Traits-%s.tar.gz' %
INFO['version']),
extras_require = INFO['extras_require'],
ext_modules = [ctraits, speedups],
include_package_data = True,
install_requires = INFO['install_requires'],
license = 'BSD',
long_description = '\n'.join(DOCLINES[3:]),
maintainer = 'ETS Developers',
maintainer_email = 'enthought-dev@enthought.com',
name = 'Traits',
namespace_packages = [
'enthought',
'enthought.traits',
'enthought.traits.ui',
],
packages = find_packages(exclude = [
'docs',
'docs.*',
'integrationtests',
'integrationtests.*',
]),
platforms = ["Windows", "Linux", "Mac OS-X", "Unix", "Solaris"],
setup_requires = 'setupdocs>=1.0',
tests_require = [
'nose >= 0.10.3',
],
test_suite = 'nose.collector',
url = 'http://code.enthought.com/projects/traits',
version = INFO['version'],
zip_safe = False,
)