[10/24] rework assumptions.py to use FactRules (assume typeinfo)
[sympy.git] / setup.py
blob8b22b68a59c4b093e896b8f428e4ab63f8169f0f
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.interactive', [] ),
56 ( True, 'sympy.matrices', [] ),
57 ( True, 'sympy.ntheory', [] ),
58 ( False, 'sympy.parsing', [] ),
59 ( True, 'sympy.physics', [] ),
60 ( False, 'sympy.plotting', [] ),
61 ( False, 'sympy.thirdparty', [] ),
62 ( False, 'sympy.mpmath', [] ),
63 ( True, 'sympy.polynomials', [] ),
64 ( True, 'sympy.polynomials.fast', [] ),
65 ( True, 'sympy.polys', ['wrappers'] ),
66 ( True, 'sympy.printing', ['gtk', 'tree'] ),
67 ( True, 'sympy.printing.pretty', [] ),
68 ( True, 'sympy.series', ["limits"] ),
69 ( True, 'sympy.simplify', [] ),
70 ( True, 'sympy.solvers', [] ),
71 ( True, 'sympy.statistics', [] ),
72 ( True, 'sympy.utilities', ["compilef"] ),
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 def setup_pprint(doctest):
197 from sympy import pprint_use_unicode
198 # use ascii pprint in doctests
199 pprint_use_unicode(False)
201 suite = unittest.TestSuite()
203 for perform, module, specific in modules:
204 if perform == True:
205 path = module.replace('.', '/')
207 items = glob.glob(path + '/[a-z][a-z0-9_]*.py')
208 items = [ i.replace('\\', '/') for i in items ]
210 for omit in specific:
211 items.remove(path + '/' + omit + '.py')
213 for item in items:
214 module = item.replace('/', '.')[:-3]
215 suite.addTest(doctest.DocTestSuite(module, setUp=setup_pprint))
217 runner = unittest.TextTestRunner()
218 runner.run(suite)
220 # Check that this list is uptodate against the result of the command:
221 # $ python bin/generate_test_list.py
222 tests = [
223 'sympy.concrete.tests',
224 'sympy.core.tests',
225 'sympy.functions.combinatorial.tests',
226 'sympy.functions.elementary.tests',
227 'sympy.functions.special.tests',
228 'sympy.geometry.tests',
229 'sympy.integrals.tests',
230 'sympy.matrices.tests',
231 'sympy.mpmath.tests',
232 'sympy.ntheory.tests',
233 'sympy.parsing.tests',
234 'sympy.physics.tests',
235 'sympy.plotting.tests',
236 'sympy.polynomials.tests',
237 'sympy.polys.tests',
238 'sympy.printing.pretty.tests',
239 'sympy.printing.tests',
240 'sympy.series.tests',
241 'sympy.simplify.tests',
242 'sympy.solvers.tests',
243 'sympy.statistics.tests',
244 'sympy.test_external',
245 'sympy.utilities.tests',
248 # update the following list from:
249 # http://pyglet.googlecode.com/svn/trunk/setup.py
250 # (whenever we update pyglet in sympy)
251 pyglet_packages=[
252 'pyglet',
253 'pyglet.gl',
254 'pyglet.font',
255 'pyglet.image',
256 'pyglet.image.codecs',
257 'pyglet.media',
258 'pyglet.media.drivers',
259 'pyglet.media.drivers.alsa',
260 'pyglet.media.drivers.directsound',
261 'pyglet.media.drivers.openal',
262 'pyglet.window',
263 'pyglet.window.carbon',
264 'pyglet.window.win32',
265 'pyglet.window.xlib',
267 pyglet_packages = ["sympy.thirdparty.pyglet." + s for s in pyglet_packages]
269 setup(
270 name = 'sympy',
271 version = sympy.__version__,
272 description = 'Computer algebra system (CAS) in Python',
273 license = 'BSD',
274 url = 'http://code.google.com/p/sympy',
275 packages = ['sympy'] + [ m[1] for m in modules ] + tests + \
276 pyglet_packages,
277 scripts = ['bin/isympy'],
278 ext_modules = [],
279 package_data = { 'sympy.utilities.mathml' : ['data/*.xsl'] },
280 data_files = [('share/man/man1', ['doc/man/isympy.1'])],
281 cmdclass = {'test': test_sympy,
282 'test_core' : test_sympy_core,
283 'test_doc' : test_sympy_doc,
284 'gen_doc' : gen_doc,
285 'clean' : clean,