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.
30 from distutils
.core
import setup
31 from distutils
.core
import Command
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" % \
42 #Check that this list is uptodate against the result of the command:
43 #$ find * -name __init__.py |sort
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 ( True, 'sympy.numerics', [] ),
59 ( False, 'sympy.parsing', [] ),
60 ( True, 'sympy.physics', [] ),
61 ( False, 'sympy.plotting', [] ),
62 ( False, 'sympy.thirdparty.mpmath', [] ),
63 ( False, 'sympy.thirdparty.mpmath.lib', [] ),
64 ( True, 'sympy.polynomials', [] ),
65 ( True, 'sympy.polynomials.fast', [] ),
66 ( True, 'sympy.polys', [] ),
67 ( True, 'sympy.printing', ['gtk'] ),
68 ( True, 'sympy.printing.pretty', [] ),
69 ( True, 'sympy.series', ["limits"] ),
70 ( True, 'sympy.simplify', [] ),
71 ( True, 'sympy.solvers', [] ),
72 ( True, 'sympy.specfun', [] ),
73 ( True, 'sympy.statistics', [] ),
74 ( True, 'sympy.utilities', [] ),
75 ( True, 'sympy.utilities.mathml', [] ),
79 """Cleans *.pyc and debian trashs, so you should get the same copy as
83 description
= "Clean everything"
84 user_options
= [("all","a","the same")]
86 def initialize_options(self
):
89 def finalize_options(self
):
94 os
.system("py.cleanup")
95 os
.system("rm -f python-build-stamp-2.4")
96 os
.system("rm -f MANIFEST")
97 os
.system("rm -rf build")
98 os
.system("rm -rf dist")
100 class gen_doc(Command
):
101 """Generate the (html) api documentation using epydoc
103 output is sent to the directory ../api/
106 description
= "generate the api doc"
109 target_dir
= "../api/"
111 def initialize_options(self
):
114 def finalize_options(self
):
119 os
.system("epydoc --no-frames -o %s sympy" % self
.target_dir
)
122 class test_sympy_core(Command
):
123 """Run only the tests concerning features of sympy.core.
124 It's a lot faster than running the complete test suite.
127 description
= "Automatically run the core test suite for Sympy."
128 user_options
= [] # distutils complains if this is not here.
130 def initialize_options(self
): # distutils wants this
133 def finalize_options(self
): # this too
141 print """In order to run the tests, you need codespeak's py.lib
142 web page: http://codespeak.net/py/dist/
143 If you are on debian systems, the package is named python-codespeak-lib
146 py
.test
.cmdline
.main(args
=["sympy/core/tests"])
149 class test_sympy(Command
):
150 """Runs all tests under the sympy/ folder
153 description
= "Automatically run the test suite for Sympy."
154 user_options
= [] # distutils complains if this is not here.
156 def __init__(self
, *args
):
157 self
.args
= args
[0] # so we can pass it to other classes
158 Command
.__init
__(self
, *args
)
160 def initialize_options(self
): # distutils wants this
163 def finalize_options(self
): # this too
170 print """In order to run the tests, you need codespeak's py.lib
171 web page: http://codespeak.net/py/dist/
172 If you are on debian systems, the package is named python-codespeak-lib
175 pylib
.test
.cmdline
.main(args
=["sympy"])
176 tdoc
= test_sympy_doc(self
.args
)
177 tdoc
.run() # run also the doc test suite
179 class test_sympy_doc(Command
):
181 description
= "Run the tests for the examples in the documentation"
182 user_options
= [] # distutils complains if this is not here.
184 def initialize_options(self
): # distutils wants this
187 def finalize_options(self
): # this too
196 print "Testing docstrings."
198 def setup_pprint(doctest
):
199 from sympy
import pprint_use_unicode
200 # use ascii pprint in doctests
201 pprint_use_unicode(False)
203 suite
= unittest
.TestSuite()
205 for perform
, module
, specific
in modules
:
207 path
= module
.replace('.', '/')
209 items
= glob
.glob(path
+ '/[a-z][a-z0-9_]*.py')
210 items
= [ i
.replace('\\', '/') for i
in items
]
212 for omit
in specific
:
213 items
.remove(path
+ '/' + omit
+ '.py')
216 module
= item
.replace('/', '.')[:-3]
217 suite
.addTest(doctest
.DocTestSuite(module
, setUp
=setup_pprint
))
219 runner
= unittest
.TextTestRunner()
222 # Check that this list is uptodate against the result of the command:
223 # $ python bin/generate_test_list.py
225 'sympy.concrete.tests',
227 'sympy.functions.combinatorial.tests',
228 'sympy.functions.elementary.tests',
229 'sympy.functions.special.tests',
230 'sympy.geometry.tests',
231 'sympy.integrals.tests',
232 'sympy.matrices.tests',
233 'sympy.ntheory.tests',
234 'sympy.numerics.tests',
235 'sympy.parsing.tests',
236 'sympy.physics.tests',
237 'sympy.plotting.tests',
238 'sympy.polynomials.tests',
240 'sympy.printing.tests',
241 'sympy.series.tests',
242 'sympy.simplify.tests',
243 'sympy.solvers.tests',
244 'sympy.specfun.tests',
245 'sympy.statistics.tests',
246 'sympy.test_external',
247 'sympy.utilities.tests',
250 # update the following list from:
251 # http://pyglet.googlecode.com/svn/trunk/setup.py
252 # (whenever we update pyglet in sympy)
258 'pyglet.image.codecs',
260 'pyglet.media.drivers',
261 'pyglet.media.drivers.alsa',
262 'pyglet.media.drivers.directsound',
263 'pyglet.media.drivers.openal',
265 'pyglet.window.carbon',
266 'pyglet.window.win32',
267 'pyglet.window.xlib',
269 pyglet_packages
= ["sympy.thirdparty.pyglet." + s
for s
in pyglet_packages
]
273 version
= sympy
.__version
__,
274 description
= 'Computer algebra system (CAS) in Python',
276 url
= 'http://code.google.com/p/sympy',
277 packages
= ['sympy'] + [ m
[1] for m
in modules
] + tests
+ \
279 scripts
= ['bin/isympy'],
281 package_data
= { 'sympy.utilities.mathml' : ['data/*.xsl'] },
282 data_files
= [('share/man/man1', ['doc/man/isympy.1'])],
283 cmdclass
= {'test': test_sympy
,
284 'test_core' : test_sympy_core
,
285 'test_doc' : test_sympy_doc
,