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.ext', [] ),
62 ( False, 'sympy.plotting.pyglet.font', [] ),
63 ( False, 'sympy.plotting.pyglet.gl', [] ),
64 ( False, 'sympy.plotting.pyglet.image', [] ),
65 ( False, 'sympy.plotting.pyglet.image.codecs', [] ),
66 ( False, 'sympy.plotting.pyglet.media', [] ),
67 ( False, 'sympy.plotting.pyglet.window', [] ),
68 ( False, 'sympy.plotting.pyglet.window.carbon', [] ),
69 ( False, 'sympy.plotting.pyglet.window.win32', [] ),
70 ( False, 'sympy.plotting.pyglet.window.xlib', [] ),
71 ( True, 'sympy.polynomials', [] ),
72 ( True, 'sympy.polynomials.fast', [] ),
73 ( True, 'sympy.printing', ['gtk', 'pygame_'] ),
74 ( True, 'sympy.series', ["limits"] ),
75 ( True, 'sympy.simplify', [] ),
76 ( True, 'sympy.solvers', [] ),
77 ( True, 'sympy.specfun', [] ),
78 ( True, 'sympy.statistics', [] ),
79 ( True, 'sympy.utilities', [] ),
80 ( True, 'sympy.utilities.mathml', [] ),
84 """Cleans *.pyc and debian trashs, so you should get the same copy as
88 description
= "Clean everything"
89 user_options
= [("all","a","the same")]
91 def initialize_options(self
):
94 def finalize_options(self
):
99 os
.system("py.cleanup")
100 os
.system("rm -f python-build-stamp-2.4")
101 os
.system("rm -f MANIFEST")
102 os
.system("rm -rf build")
103 os
.system("rm -rf dist")
105 class gen_doc(Command
):
106 """Generate the (html) api documentation using epydoc
108 output is sent to the directory ../api/
111 description
= "generate the api doc"
114 target_dir
= "../api/"
116 def initialize_options(self
):
119 def finalize_options(self
):
124 os
.system("epydoc --no-frames -o %s sympy" % self
.target_dir
)
127 class test_sympy_core(Command
):
128 """Run only the tests concerning features of sympy.core.
129 It's a lot faster than running the complete test suite.
132 description
= "Automatically run the core test suite for Sympy."
133 user_options
= [] # distutils complains if this is not here.
135 def initialize_options(self
): # distutils wants this
138 def finalize_options(self
): # this too
146 print """In order to run the tests, you need codespeak's py.lib
147 web page: http://codespeak.net/py/dist/
148 If you are on debian systems, the package is named python-codespeak-lib
151 py
.test
.cmdline
.main(args
=["sympy/core/tests"])
154 class test_sympy(Command
):
155 """Runs all tests under the sympy/ folder
158 description
= "Automatically run the test suite for Sympy."
159 user_options
= [] # distutils complains if this is not here.
161 def __init__(self
, *args
):
162 self
.args
= args
[0] # so we can pass it to other classes
163 Command
.__init
__(self
, *args
)
165 def initialize_options(self
): # distutils wants this
168 def finalize_options(self
): # this too
175 print """In order to run the tests, you need codespeak's py.lib
176 web page: http://codespeak.net/py/dist/
177 If you are on debian systems, the package is named python-codespeak-lib
180 pylib
.test
.cmdline
.main(args
=["sympy"])
181 tdoc
= test_sympy_doc(self
.args
)
182 tdoc
.run() # run also the doc test suite
184 class test_sympy_doc(Command
):
186 description
= "Run the tests for the examples in the documentation"
187 user_options
= [] # distutils complains if this is not here.
189 def initialize_options(self
): # distutils wants this
192 def finalize_options(self
): # this too
201 print "Testing docstrings."
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
))
219 runner
= unittest
.TextTestRunner()
222 #Check that this list is uptodate against the result of the command:
223 #$ find * -name tests |sort
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.physics.tests',
236 'sympy.plotting.tests',
237 'sympy.polynomials.tests',
238 'sympy.printing.tests',
239 'sympy.series.tests',
240 'sympy.simplify.tests',
241 'sympy.solvers.tests',
242 'sympy.specfun.tests',
243 'sympy.statistics.tests',
244 'sympy.utilities.tests',
249 version
= sympy
.__version
__,
250 description
= 'Computer algebra system (CAS) in Python',
252 url
= 'http://code.google.com/p/sympy',
253 packages
= ['sympy'] + [ m
[1] for m
in modules
] + tests
,
254 scripts
= ['bin/isympy'],
256 data_files
= [('share/man/man1', ['doc/man/isympy.1'])],
257 cmdclass
= {'test': test_sympy
,
258 'test_core' : test_sympy_core
,
259 'test_doc' : test_sympy_doc
,