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 ( 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', [] ),
77 """Cleans *.pyc and debian trashs, so you should get the same copy as
81 description
= "Clean everything"
82 user_options
= [("all","a","the same")]
84 def initialize_options(self
):
87 def finalize_options(self
):
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"
107 target_dir
= "../api/"
109 def initialize_options(self
):
112 def finalize_options(self
):
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
131 def finalize_options(self
): # this too
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
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
161 def finalize_options(self
): # this too
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
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
185 def finalize_options(self
): # this too
194 print "Testing docstrings."
197 from sympy
import pprint_use_unicode
198 # force pprint to be in ascii mode in doctests
199 pprint_use_unicode(False)
201 # hook our nice, hash-stable strprinter
202 from sympy
.interactive
import init_printing
203 from sympy
.printing
import sstrrepr
204 init_printing(sstrrepr
)
206 suite
= unittest
.TestSuite()
208 for perform
, module
, specific
in modules
:
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')
219 module
= item
.replace('/', '.')[:-3]
220 suite
.addTest(doctest
.DocTestSuite(module
))
224 runner
= unittest
.TextTestRunner()
227 # Check that this list is uptodate against the result of the command:
228 # $ python bin/generate_test_list.py
230 'sympy.concrete.tests',
232 'sympy.functions.combinatorial.tests',
233 'sympy.functions.elementary.tests',
234 'sympy.functions.special.tests',
235 'sympy.geometry.tests',
236 'sympy.integrals.tests',
237 'sympy.matrices.tests',
238 'sympy.mpmath.tests',
239 'sympy.ntheory.tests',
240 'sympy.parsing.tests',
241 'sympy.physics.tests',
242 'sympy.plotting.tests',
243 'sympy.polynomials.tests',
245 'sympy.printing.pretty.tests',
246 'sympy.printing.tests',
247 'sympy.series.tests',
248 'sympy.simplify.tests',
249 'sympy.solvers.tests',
250 'sympy.statistics.tests',
251 'sympy.test_external',
252 'sympy.utilities.tests',
255 # update the following list from:
256 # http://pyglet.googlecode.com/svn/trunk/setup.py
257 # (whenever we update pyglet in sympy)
263 'pyglet.image.codecs',
265 'pyglet.media.drivers',
266 'pyglet.media.drivers.alsa',
267 'pyglet.media.drivers.directsound',
268 'pyglet.media.drivers.openal',
270 'pyglet.window.carbon',
271 'pyglet.window.win32',
272 'pyglet.window.xlib',
274 pyglet_packages
= ["sympy.thirdparty.pyglet." + s
for s
in pyglet_packages
]
278 version
= sympy
.__version
__,
279 description
= 'Computer algebra system (CAS) in Python',
281 url
= 'http://code.google.com/p/sympy',
282 packages
= ['sympy'] + [ m
[1] for m
in modules
] + tests
+ \
284 scripts
= ['bin/isympy'],
286 package_data
= { 'sympy.utilities.mathml' : ['data/*.xsl'] },
287 data_files
= [('share/man/man1', ['doc/man/isympy.1'])],
288 cmdclass
= {'test': test_sympy
,
289 'test_core' : test_sympy_core
,
290 'test_doc' : test_sympy_doc
,