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" % \
43 # do docstring # module name # omit those even if the first field is True
45 ['add', 'mul', 'relational', 'interval'] ),
46 ( True, 'sympy.concrete', [] ),
47 ( True, 'sympy.functions', [] ),
48 ( True, 'sympy.functions.combinatorial', [] ),
49 ( True, 'sympy.functions.elementary',
50 ['miscellaneous', 'trigonometric', 'hyperbolic', 'exponential'] ),
51 ( False, 'sympy.functions.special', [] ),
52 ( True, 'sympy.geometry', [] ),
53 ( True, 'sympy.integrals', [] ),
54 ( True, 'sympy.matrices', [] ),
55 ( True, 'sympy.ntheory', [] ),
56 ( True, 'sympy.numerics', [] ),
57 ( True, 'sympy.physics', [] ),
58 ( True, 'sympy.polynomials', [] ),
59 ( True, 'sympy.polynomials.fast', [] ),
60 ( True, 'sympy.printing',
62 ( True, 'sympy.series', ["limits"] ),
63 ( True, 'sympy.simplify', [] ),
64 ( True, 'sympy.solvers', [] ),
65 ( True, 'sympy.utilities', [] ),
66 ( False, 'sympy.plotting', [] ),
67 ( False, 'sympy.plotting.pyglet', [] ),
68 ( False, 'sympy.plotting.pyglet.ext', [] ),
69 ( False, 'sympy.plotting.pyglet.font', [] ),
70 ( False, 'sympy.plotting.pyglet.gl', [] ),
71 ( False, 'sympy.plotting.pyglet.image', [] ),
72 ( False, 'sympy.plotting.pyglet.image.codecs', [] ),
73 ( False, 'sympy.plotting.pyglet.media', [] ),
74 ( False, 'sympy.plotting.pyglet.window', [] ),
75 ( False, 'sympy.plotting.pyglet.window.carbon', [] ),
76 ( False, 'sympy.plotting.pyglet.window.win32', [] ),
77 ( False, 'sympy.plotting.pyglet.window.xlib', [] ),
81 """Cleans *.pyc and debian trashs, so you should get the same copy as
85 description
= "Clean everything"
86 user_options
= [("all","a","the same")]
88 def initialize_options(self
):
91 def finalize_options(self
):
96 os
.system("py.cleanup")
97 os
.system("rm -f python-build-stamp-2.4")
98 os
.system("rm -f MANIFEST")
99 os
.system("rm -rf build")
100 os
.system("rm -rf dist")
102 class gen_doc(Command
):
103 """Generate the (html) api documentation using epydoc
105 output is sent to the directory ../api/
108 description
= "generate the api doc"
111 target_dir
= "../api/"
113 def initialize_options(self
):
116 def finalize_options(self
):
121 os
.system("epydoc --no-frames -o %s sympy" % self
.target_dir
)
124 class test_sympy_core(Command
):
125 """Run only the tests concerning features of sympy.core.
126 It's a lot faster than running the complete test suite.
129 description
= "Automatically run the core test suite for Sympy."
130 user_options
= [] # distutils complains if this is not here.
132 def initialize_options(self
): # distutils wants this
135 def finalize_options(self
): # this too
143 print """In order to run the tests, you need codespeak's py.lib
144 web page: http://codespeak.net/py/dist/
145 If you are on debian systems, the package is named python-codespeak-lib
148 py
.test
.cmdline
.main(args
=["sympy/core/tests"])
151 class test_sympy(Command
):
152 """Runs all tests under the sympy/ folder
155 description
= "Automatically run the test suite for Sympy."
156 user_options
= [] # distutils complains if this is not here.
158 def __init__(self
, *args
):
159 self
.args
= args
[0] # so we can pass it to other classes
160 Command
.__init
__(self
, *args
)
162 def initialize_options(self
): # distutils wants this
165 def finalize_options(self
): # this too
172 print """In order to run the tests, you need codespeak's py.lib
173 web page: http://codespeak.net/py/dist/
174 If you are on debian systems, the package is named python-codespeak-lib
177 pylib
.test
.cmdline
.main(args
=["sympy"])
178 tdoc
= test_sympy_doc(self
.args
)
179 tdoc
.run() # run also the doc test suite
181 class test_sympy_doc(Command
):
183 description
= "Run the tests for the examples in the documentation"
184 user_options
= [] # distutils complains if this is not here.
186 def initialize_options(self
): # distutils wants this
189 def finalize_options(self
): # this too
198 print "Testing docstrings."
200 suite
= unittest
.TestSuite()
202 for perform
, module
, specific
in modules
:
204 path
= module
.replace('.', '/')
206 items
= glob
.glob(path
+ '/[a-z][a-z0-9_]*.py')
207 items
= [ i
.replace('\\', '/') for i
in items
]
209 for omit
in specific
:
210 items
.remove(path
+ '/' + omit
+ '.py')
213 module
= item
.replace('/', '.')[:-3]
214 suite
.addTest(doctest
.DocTestSuite(module
))
216 runner
= unittest
.TextTestRunner()
221 'sympy.concrete.tests',
222 'sympy.functions.combinatorial.tests',
223 'sympy.functions.elementary.tests',
224 'sympy.functions.special.tests',
225 'sympy.geometry.tests',
226 'sympy.integrals.tests',
227 'sympy.matrices.tests',
228 'sympy.numerics.tests',
229 'sympy.ntheory.tests',
230 'sympy.physics.tests',
231 'sympy.polynomials.tests',
232 'sympy.printing.tests',
233 'sympy.series.tests',
234 'sympy.simplify.tests',
235 'sympy.solvers.tests',
236 'sympy.utilities.tests',
237 'sympy.plotting.tests',
242 version
= sympy
.__version
__,
243 description
= 'Computer algebra system (CAS) in Python',
245 url
= 'http://code.google.com/p/sympy',
246 packages
= ['sympy'] + [ m
[1] for m
in modules
] + tests
,
247 scripts
= ['bin/isympy'],
249 data_files
= [('share/man/man1', ['doc/man/isympy.1'])],
250 cmdclass
= {'test': test_sympy
,
251 'test_core' : test_sympy_core
,
252 'test_doc' : test_sympy_doc
,