RelMeths.__eq__() simplified
[sympy.git] / setup.py
blob0db13f7f7749fe1c7183cb2948b3bc8a50beb919
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'] ),
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 ( True, 'sympy.physics', [] ),
59 ( False, 'sympy.plotting', [] ),
60 ( False, 'sympy.plotting.pyglet', [] ),
61 ( False, 'sympy.plotting.pyglet.font', [] ),
62 ( False, 'sympy.plotting.pyglet.gl', [] ),
63 ( False, 'sympy.plotting.pyglet.image', [] ),
64 ( False, 'sympy.plotting.pyglet.image.codecs', [] ),
65 ( False, 'sympy.plotting.pyglet.media', [] ),
66 ( False, 'sympy.plotting.pyglet.media.drivers', [] ),
67 ( False, 'sympy.plotting.pyglet.media.drivers.alsa', [] ),
68 ( False, 'sympy.plotting.pyglet.media.drivers.directsound', [] ),
69 ( False, 'sympy.plotting.pyglet.media.drivers.openal', [] ),
70 ( False, 'sympy.plotting.pyglet.window', [] ),
71 ( False, 'sympy.plotting.pyglet.window.carbon', [] ),
72 ( False, 'sympy.plotting.pyglet.window.win32', [] ),
73 ( False, 'sympy.plotting.pyglet.window.xlib', [] ),
74 ( True, 'sympy.polynomials', [] ),
75 ( True, 'sympy.polynomials.fast', [] ),
76 ( True, 'sympy.printing', ['gtk', 'pygame_'] ),
77 ( True, 'sympy.series', ["limits"] ),
78 ( True, 'sympy.simplify', [] ),
79 ( True, 'sympy.solvers', [] ),
80 ( True, 'sympy.specfun', [] ),
81 ( True, 'sympy.statistics', [] ),
82 ( True, 'sympy.utilities', [] ),
83 ( True, 'sympy.utilities.mathml', [] ),
86 class clean(Command):
87 """Cleans *.pyc and debian trashs, so you should get the same copy as
88 is in the svn.
89 """
91 description = "Clean everything"
92 user_options = [("all","a","the same")]
94 def initialize_options(self):
95 self.all = None
97 def finalize_options(self):
98 pass
100 def run(self):
101 import os
102 os.system("py.cleanup")
103 os.system("rm -f python-build-stamp-2.4")
104 os.system("rm -f MANIFEST")
105 os.system("rm -rf build")
106 os.system("rm -rf dist")
108 class gen_doc(Command):
109 """Generate the (html) api documentation using epydoc
111 output is sent to the directory ../api/
114 description = "generate the api doc"
115 user_options = []
117 target_dir = "../api/"
119 def initialize_options(self):
120 self.all = None
122 def finalize_options(self):
123 pass
125 def run(self):
126 import os
127 os.system("epydoc --no-frames -o %s sympy" % self.target_dir)
130 class test_sympy_core(Command):
131 """Run only the tests concerning features of sympy.core.
132 It's a lot faster than running the complete test suite.
135 description = "Automatically run the core test suite for Sympy."
136 user_options = [] # distutils complains if this is not here.
138 def initialize_options(self): # distutils wants this
139 pass
141 def finalize_options(self): # this too
142 pass
145 def run(self):
146 try:
147 import py
148 except ImportError:
149 print """In order to run the tests, you need codespeak's py.lib
150 web page: http://codespeak.net/py/dist/
151 If you are on debian systems, the package is named python-codespeak-lib
153 sys.exit(-1)
154 py.test.cmdline.main(args=["sympy/core/tests"])
157 class test_sympy(Command):
158 """Runs all tests under the sympy/ folder
161 description = "Automatically run the test suite for Sympy."
162 user_options = [] # distutils complains if this is not here.
164 def __init__(self, *args):
165 self.args = args[0] # so we can pass it to other classes
166 Command.__init__(self, *args)
168 def initialize_options(self): # distutils wants this
169 pass
171 def finalize_options(self): # this too
172 pass
174 def run(self):
175 try:
176 import py as pylib
177 except ImportError:
178 print """In order to run the tests, you need codespeak's py.lib
179 web page: http://codespeak.net/py/dist/
180 If you are on debian systems, the package is named python-codespeak-lib
182 sys.exit(-1)
183 pylib.test.cmdline.main(args=["sympy"])
184 tdoc = test_sympy_doc(self.args)
185 tdoc.run() # run also the doc test suite
187 class test_sympy_doc(Command):
189 description = "Run the tests for the examples in the documentation"
190 user_options = [] # distutils complains if this is not here.
192 def initialize_options(self): # distutils wants this
193 pass
195 def finalize_options(self): # this too
196 pass
198 def run(self):
199 import unittest
200 import doctest
202 import glob
204 print "Testing docstrings."
206 suite = unittest.TestSuite()
208 for perform, module, specific in modules:
209 if perform == True:
210 path = module.replace('.', '/')
212 items = glob.glob(path + '/[a-z][a-z0-9_]*.py')
213 items = [ i.replace('\\', '/') for i in items ]
215 for omit in specific:
216 items.remove(path + '/' + omit + '.py')
218 for item in items:
219 module = item.replace('/', '.')[:-3]
220 suite.addTest(doctest.DocTestSuite(module))
222 runner = unittest.TextTestRunner()
223 runner.run(suite)
225 #Check that this list is uptodate against the result of the command:
226 #$ find * -name tests |sort
227 tests = [
228 'sympy.concrete.tests',
229 'sympy.core.tests',
230 'sympy.functions.combinatorial.tests',
231 'sympy.functions.elementary.tests',
232 'sympy.functions.special.tests',
233 'sympy.geometry.tests',
234 'sympy.integrals.tests',
235 'sympy.matrices.tests',
236 'sympy.ntheory.tests',
237 'sympy.numerics.tests',
238 'sympy.physics.tests',
239 'sympy.plotting.tests',
240 'sympy.polynomials.tests',
241 'sympy.printing.tests',
242 'sympy.series.tests',
243 'sympy.simplify.tests',
244 'sympy.solvers.tests',
245 'sympy.specfun.tests',
246 'sympy.statistics.tests',
247 'sympy.utilities.tests',
250 setup(
251 name = 'sympy',
252 version = sympy.__version__,
253 description = 'Computer algebra system (CAS) in Python',
254 license = 'BSD',
255 url = 'http://code.google.com/p/sympy',
256 packages = ['sympy'] + [ m[1] for m in modules ] + tests,
257 scripts = ['bin/isympy'],
258 ext_modules = [],
259 data_files = [('share/man/man1', ['doc/man/isympy.1'])],
260 cmdclass = {'test': test_sympy,
261 'test_core' : test_sympy_core,
262 'test_doc' : test_sympy_doc,
263 'gen_doc' : gen_doc,
264 'clean' : clean,