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'] ),
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', [] ),
87 """Cleans *.pyc and debian trashs, so you should get the same copy as
91 description
= "Clean everything"
92 user_options
= [("all","a","the same")]
94 def initialize_options(self
):
97 def finalize_options(self
):
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"
117 target_dir
= "../api/"
119 def initialize_options(self
):
122 def finalize_options(self
):
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
141 def finalize_options(self
): # this too
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
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
171 def finalize_options(self
): # this too
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
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
195 def finalize_options(self
): # this too
204 print "Testing docstrings."
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
))
222 runner
= unittest
.TextTestRunner()
225 #Check that this list is uptodate against the result of the command:
226 #$ find * -name tests |sort
228 'sympy.concrete.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',
252 version
= sympy
.__version
__,
253 description
= 'Computer algebra system (CAS) in Python',
255 url
= 'http://code.google.com/p/sympy',
256 packages
= ['sympy'] + [ m
[1] for m
in modules
] + tests
,
257 scripts
= ['bin/isympy'],
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
,