Lambda support works now (#427)
[sympy.git] / setup.py
blob2dba085ceddcd78a716f812e949715c0ca092f10
1 #!/usr/bin/env python
2 """Distutils based setup script for Sympy.
4 This uses Distutils (http://python.org/sigs/distutils-sig/) the standard
5 python mechanism for installing packages. For the easiest installation
6 just type the command (you'll probably need root privileges for that):
8 python setup.py install
10 This will install the library in the default location. For instructions on
11 how to customize the install procedure read the output of:
13 python setup.py --help install
15 In addition, there are some other commands:
17 python setup.py clean -> will clean all trash (*.pyc and stuff)
18 python setup.py test -> will run the complete test suite
19 python setup.py test_core -> will run only tests concerning core features
20 python setup.py test_doc -> will run tests on the examples of the documentation
22 To get a full list of avaiable commands, read the output of:
24 python setup.py --help-commands
26 Or, if all else fails, feel free to write to the sympy list at
27 sympy@googlegroups.com and ask for help.
28 """
30 from distutils.core import setup
31 from distutils.core import Command
32 import sys
34 import sympy
36 # Make sure I have the right Python version.
37 if sys.version_info[1] < 4:
38 print "Sympy requires Python 2.4 or newer. Python %d.%d detected" % \
39 sys.version_info[:2]
40 sys.exit(-1)
42 #Check that this list is uptodate against the result of the command:
43 #$ find * -name __init__.py |sort
44 modules = [
45 # do docstring # module name # omit those even if the first field is True
46 ( True, 'sympy.concrete', [] ),
47 ( True, 'sympy.core', ['add', 'mul', 'relational', 'interval', 'ast_parser'] ),
48 ( True, 'sympy.functions', [] ),
49 ( True, 'sympy.functions.combinatorial', [] ),
50 ( True, 'sympy.functions.elementary',
51 ['miscellaneous', 'trigonometric', 'hyperbolic', 'exponential'] ),
52 ( False, 'sympy.functions.special', [] ),
53 ( True, 'sympy.geometry', [] ),
54 ( True, 'sympy.integrals', [] ),
55 ( True, 'sympy.matrices', [] ),
56 ( True, 'sympy.ntheory', [] ),
57 ( True, 'sympy.numerics', [] ),
58 ( False, 'sympy.parsing', [] ),
59 ( True, 'sympy.physics', [] ),
60 ( False, 'sympy.plotting', [] ),
61 ( False, 'sympy.thirdparty.mpmath', [] ),
62 ( False, 'sympy.thirdparty.mpmath.lib', [] ),
63 ( True, 'sympy.polynomials', [] ),
64 ( True, 'sympy.polynomials.fast', [] ),
65 ( True, 'sympy.printing', ['gtk'] ),
66 ( True, 'sympy.printing.pretty', [] ),
67 ( True, 'sympy.series', ["limits"] ),
68 ( True, 'sympy.simplify', [] ),
69 ( True, 'sympy.solvers', [] ),
70 ( True, 'sympy.specfun', [] ),
71 ( True, 'sympy.statistics', [] ),
72 ( True, 'sympy.utilities', [] ),
73 ( True, 'sympy.utilities.mathml', [] ),
76 class clean(Command):
77 """Cleans *.pyc and debian trashs, so you should get the same copy as
78 is in the svn.
79 """
81 description = "Clean everything"
82 user_options = [("all","a","the same")]
84 def initialize_options(self):
85 self.all = None
87 def finalize_options(self):
88 pass
90 def run(self):
91 import os
92 os.system("py.cleanup")
93 os.system("rm -f python-build-stamp-2.4")
94 os.system("rm -f MANIFEST")
95 os.system("rm -rf build")
96 os.system("rm -rf dist")
98 class gen_doc(Command):
99 """Generate the (html) api documentation using epydoc
101 output is sent to the directory ../api/
104 description = "generate the api doc"
105 user_options = []
107 target_dir = "../api/"
109 def initialize_options(self):
110 self.all = None
112 def finalize_options(self):
113 pass
115 def run(self):
116 import os
117 os.system("epydoc --no-frames -o %s sympy" % self.target_dir)
120 class test_sympy_core(Command):
121 """Run only the tests concerning features of sympy.core.
122 It's a lot faster than running the complete test suite.
125 description = "Automatically run the core test suite for Sympy."
126 user_options = [] # distutils complains if this is not here.
128 def initialize_options(self): # distutils wants this
129 pass
131 def finalize_options(self): # this too
132 pass
135 def run(self):
136 try:
137 import py
138 except ImportError:
139 print """In order to run the tests, you need codespeak's py.lib
140 web page: http://codespeak.net/py/dist/
141 If you are on debian systems, the package is named python-codespeak-lib
143 sys.exit(-1)
144 py.test.cmdline.main(args=["sympy/core/tests"])
147 class test_sympy(Command):
148 """Runs all tests under the sympy/ folder
151 description = "Automatically run the test suite for Sympy."
152 user_options = [] # distutils complains if this is not here.
154 def __init__(self, *args):
155 self.args = args[0] # so we can pass it to other classes
156 Command.__init__(self, *args)
158 def initialize_options(self): # distutils wants this
159 pass
161 def finalize_options(self): # this too
162 pass
164 def run(self):
165 try:
166 import py as pylib
167 except ImportError:
168 print """In order to run the tests, you need codespeak's py.lib
169 web page: http://codespeak.net/py/dist/
170 If you are on debian systems, the package is named python-codespeak-lib
172 sys.exit(-1)
173 pylib.test.cmdline.main(args=["sympy"])
174 tdoc = test_sympy_doc(self.args)
175 tdoc.run() # run also the doc test suite
177 class test_sympy_doc(Command):
179 description = "Run the tests for the examples in the documentation"
180 user_options = [] # distutils complains if this is not here.
182 def initialize_options(self): # distutils wants this
183 pass
185 def finalize_options(self): # this too
186 pass
188 def run(self):
189 import unittest
190 import doctest
192 import glob
194 print "Testing docstrings."
196 suite = unittest.TestSuite()
198 for perform, module, specific in modules:
199 if perform == True:
200 path = module.replace('.', '/')
202 items = glob.glob(path + '/[a-z][a-z0-9_]*.py')
203 items = [ i.replace('\\', '/') for i in items ]
205 for omit in specific:
206 items.remove(path + '/' + omit + '.py')
208 for item in items:
209 module = item.replace('/', '.')[:-3]
210 suite.addTest(doctest.DocTestSuite(module))
212 runner = unittest.TextTestRunner()
213 runner.run(suite)
215 #Check that this list is uptodate against the result of the command:
216 #$ find * -name tests |sort
217 tests = [
218 'sympy.concrete.tests',
219 'sympy.core.tests',
220 'sympy.functions.combinatorial.tests',
221 'sympy.functions.elementary.tests',
222 'sympy.functions.special.tests',
223 'sympy.geometry.tests',
224 'sympy.integrals.tests',
225 'sympy.matrices.tests',
226 'sympy.ntheory.tests',
227 'sympy.numerics.tests',
228 'sympy.parsing.tests',
229 'sympy.physics.tests',
230 'sympy.plotting.tests',
231 'sympy.polynomials.tests',
232 'sympy.printing.tests',
233 'sympy.series.tests',
234 'sympy.simplify.tests',
235 'sympy.solvers.tests',
236 'sympy.specfun.tests',
237 'sympy.statistics.tests',
238 'sympy.utilities.tests',
241 pyglet_packages=[
242 'pyglet',
243 'pyglet.gl',
244 'pyglet.font',
245 'pyglet.image',
246 'pyglet.image.codecs',
247 'pyglet.media',
248 'pyglet.media.drivers',
249 'pyglet.media.drivers.alsa',
250 'pyglet.media.drivers.directsound',
251 'pyglet.media.drivers.openal',
252 'pyglet.window',
253 'pyglet.window.carbon',
254 'pyglet.window.win32',
255 'pyglet.window.xlib',
257 pyglet_packages = ["sympy.thirdparty.pyglet." + s for s in pyglet_packages]
259 setup(
260 name = 'sympy',
261 version = sympy.__version__,
262 description = 'Computer algebra system (CAS) in Python',
263 license = 'BSD',
264 url = 'http://code.google.com/p/sympy',
265 packages = ['sympy'] + [ m[1] for m in modules ] + tests + \
266 pyglet_packages,
267 scripts = ['bin/isympy'],
268 ext_modules = [],
269 package_data = { 'sympy.utilities.mathml' : ['data/*.xsl'] },
270 data_files = [('share/man/man1', ['doc/man/isympy.1'])],
271 cmdclass = {'test': test_sympy,
272 'test_core' : test_sympy_core,
273 'test_doc' : test_sympy_doc,
274 'gen_doc' : gen_doc,
275 'clean' : clean,