Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 307 lines (259 sloc) 9.679 kB
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
1 #!/usr/bin/env python
9379e66 @vks remove setup.py gen_doc
vks authored
2 """Distutils based setup script for SymPy.
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
3
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):
7
8 python setup.py install
9
10 This will install the library in the default location. For instructions on
11 how to customize the install procedure read the output of:
12
13 python setup.py --help install
14
15 In addition, there are some other commands:
16
17 python setup.py clean -> will clean all trash (*.pyc and stuff)
18 python setup.py test -> will run the complete test suite
38eb78b @vks fix some descriptions
vks authored
19 python setup.py bench -> will run the complete benchmark suite
26c37e8 @plaes Add audit command to setup.py that checks source code using PyFlakes.
plaes authored
20 python setup.py audit -> will run pyflakes checker on source code
5009295 Merged matrices. Bug fix in resultant() (made it working for 'sparse'…
mattpap authored
21
22 To get a full list of avaiable commands, read the output of:
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
23
24 python setup.py --help-commands
5009295 Merged matrices. Bug fix in resultant() (made it working for 'sparse'…
mattpap authored
25
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
26 Or, if all else fails, feel free to write to the sympy list at
27 sympy@googlegroups.com and ask for help.
28 """
29
30 from distutils.core import setup
31 from distutils.core import Command
32 import sys
4dcd62d @povik add test_sage.py to tests executed by setup.py if sage is installed; …
povik authored
33 import subprocess
34 import os
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
35
36 import sympy
37
38 # Make sure I have the right Python version.
a0e4e44 @vperic setup.py: Require Python 2.5+
vperic authored
39 if sys.version_info[:2] < (2,5):
6987487 @vperic Replace all occurances of Sympy with SymPy
vperic authored
40 print "SymPy requires Python 2.5 or newer. Python %d.%d detected" % \
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
41 sys.version_info[:2]
42 sys.exit(-1)
43
c150f04 @plaes Update list of modules
plaes authored
44 # Check that this list is uptodate against the result of the command:
0c9b60f @asmeurer Update command to get modules in setup.py
asmeurer authored
45 # $ for i in `find sympy -name __init__.py | rev | cut -f 2- -d '/' | rev | egrep -v "^sympy$" `; do echo "'${i//\//.}',"; done | sort
0872613 Moved all functions to sympy/functions (see issue 310). Cleaned a bit…
mattpap authored
46 modules = [
5be916d @certik Install assumptions and queries in setup.py
certik authored
47 'sympy.assumptions',
08066ae @vks update setup.py
vks authored
48 'sympy.assumptions.handlers',
00126e9 @rlamy Update setup.py to handle sympy.combinatorics and sympy.matrices.expr…
rlamy authored
49 'sympy.combinatorics',
c034467 @certik setup.py: modules list refactored
certik authored
50 'sympy.concrete',
51 'sympy.core',
2215c07 @asmeurer Update setup.py with the new external module
asmeurer authored
52 'sympy.external',
c034467 @certik setup.py: modules list refactored
certik authored
53 'sympy.functions',
54 'sympy.functions.combinatorial',
55 'sympy.functions.elementary',
56 'sympy.functions.special',
57 'sympy.galgebra',
58 'sympy.geometry',
59 'sympy.integrals',
60 'sympy.interactive',
a7083f4 @fabianp Add the logic module (and its tests) to the installation script
fabianp authored
61 'sympy.logic',
62 'sympy.logic.algorithms',
63 'sympy.logic.utilities',
c150f04 @plaes Update list of modules
plaes authored
64 'sympy.matrices',
00126e9 @rlamy Update setup.py to handle sympy.combinatorics and sympy.matrices.expr…
rlamy authored
65 'sympy.matrices.expressions',
c034467 @certik setup.py: modules list refactored
certik authored
66 'sympy.mpmath',
c150f04 @plaes Update list of modules
plaes authored
67 'sympy.mpmath.calculus',
9a72d81 @vks update mpmath to 0.14
vks authored
68 'sympy.mpmath.functions',
c150f04 @plaes Update list of modules
plaes authored
69 'sympy.mpmath.libmp',
9a72d81 @vks update mpmath to 0.14
vks authored
70 'sympy.mpmath.matrices',
c150f04 @plaes Update list of modules
plaes authored
71 'sympy.mpmath.tests',
72 'sympy.ntheory',
73 'sympy.parsing',
74 'sympy.physics',
2bad437 @asmeurer Add sympy.physics.mechanics to setup.py
asmeurer authored
75 'sympy.physics.mechanics',
c150f04 @plaes Update list of modules
plaes authored
76 'sympy.physics.quantum',
77 'sympy.plotting',
c034467 @certik setup.py: modules list refactored
certik authored
78 'sympy.polys',
8f8629a @mattpap Added sympy.polys.domains to setup.py
mattpap authored
79 'sympy.polys.domains',
c034467 @certik setup.py: modules list refactored
certik authored
80 'sympy.printing',
81 'sympy.printing.pretty',
82 'sympy.series',
83 'sympy.simplify',
84 'sympy.solvers',
85 'sympy.statistics',
b55d9c2 @mrocklin added sympy.stats to modules in setup.py
mrocklin authored
86 'sympy.stats',
c150f04 @plaes Update list of modules
plaes authored
87 'sympy.tensor',
c034467 @certik setup.py: modules list refactored
certik authored
88 'sympy.utilities',
89 'sympy.utilities.mathml',
00126e9 @rlamy Update setup.py to handle sympy.combinatorics and sympy.matrices.expr…
rlamy authored
90 ]
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
91
26c37e8 @plaes Add audit command to setup.py that checks source code using PyFlakes.
plaes authored
92 class audit(Command):
6987487 @vperic Replace all occurances of Sympy with SymPy
vperic authored
93 """Audits SymPy's source code for following issues:
26c37e8 @plaes Add audit command to setup.py that checks source code using PyFlakes.
plaes authored
94 - Names which are used but not defined or used before they are defined.
95 - Names which are redefined without having been used.
96 """
97
6987487 @vperic Replace all occurances of Sympy with SymPy
vperic authored
98 description = "Audit SymPy source with PyFlakes"
26c37e8 @plaes Add audit command to setup.py that checks source code using PyFlakes.
plaes authored
99 user_options = []
100
101 def initialize_options(self):
102 self.all = None
103
104 def finalize_options(self):
105 pass
106
107 def run(self):
108 import os
109 try:
110 import pyflakes.scripts.pyflakes as flakes
5bb680c Now there aren't bare except: and it is explicit what exception is th…
tsmars15 authored
111 except ImportError:
26c37e8 @plaes Add audit command to setup.py that checks source code using PyFlakes.
plaes authored
112 print """In order to run the audit, you need to have PyFlakes installed."""
113 sys.exit(-1)
1edf725 @plaes Audit: Filter out external dependencies
plaes authored
114 # We don't want to audit external dependencies
115 ext = ('mpmath',)
116 dirs = (os.path.join(*d) for d in \
117 (m.split('.') for m in modules) if d[1] not in ext)
26c37e8 @plaes Add audit command to setup.py that checks source code using PyFlakes.
plaes authored
118 warns = 0
119 for dir in dirs:
1edf725 @plaes Audit: Filter out external dependencies
plaes authored
120 for filename in os.listdir(dir):
26c37e8 @plaes Add audit command to setup.py that checks source code using PyFlakes.
plaes authored
121 if filename.endswith('.py') and filename != '__init__.py':
122 warns += flakes.checkPath(os.path.join(dir, filename))
123 if warns > 0:
124 print ("Audit finished with total %d warnings" % warns)
125
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
126 class clean(Command):
5009295 Merged matrices. Bug fix in resultant() (made it working for 'sparse'…
mattpap authored
127 """Cleans *.pyc and debian trashs, so you should get the same copy as
a13a8b8 @vks fix setup.py
vks authored
128 is in the VCS.
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
129 """
5009295 Merged matrices. Bug fix in resultant() (made it working for 'sparse'…
mattpap authored
130
38eb78b @vks fix some descriptions
vks authored
131 description = "remove build files"
5009295 Merged matrices. Bug fix in resultant() (made it working for 'sparse'…
mattpap authored
132 user_options = [("all","a","the same")]
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
133
5009295 Merged matrices. Bug fix in resultant() (made it working for 'sparse'…
mattpap authored
134 def initialize_options(self):
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
135 self.all = None
5009295 Merged matrices. Bug fix in resultant() (made it working for 'sparse'…
mattpap authored
136
137 def finalize_options(self):
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
138 pass
139
140 def run(self):
141 import os
142 os.system("py.cleanup")
143 os.system("rm -f python-build-stamp-2.4")
144 os.system("rm -f MANIFEST")
145 os.system("rm -rf build")
146 os.system("rm -rf dist")
a13a8b8 @vks fix setup.py
vks authored
147 os.system("rm -rf doc/_build")
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
148
149
150 class test_sympy(Command):
d2a14ed - Fixes for issues 229 and 211
inferno1386 authored
151 """Runs all tests under the sympy/ folder
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
152 """
5009295 Merged matrices. Bug fix in resultant() (made it working for 'sparse'…
mattpap authored
153
38eb78b @vks fix some descriptions
vks authored
154 description = "run all tests and doctests; also see bin/test and bin/doctest"
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
155 user_options = [] # distutils complains if this is not here.
156
157 def __init__(self, *args):
158 self.args = args[0] # so we can pass it to other classes
159 Command.__init__(self, *args)
160
161 def initialize_options(self): # distutils wants this
162 pass
5009295 Merged matrices. Bug fix in resultant() (made it working for 'sparse'…
mattpap authored
163
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
164 def finalize_options(self): # this too
165 pass
5009295 Merged matrices. Bug fix in resultant() (made it working for 'sparse'…
mattpap authored
166
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
167 def run(self):
a18e32e @Imran31 made doctests run even if other tests fail
Imran31 authored
168 tests_successful = True
4dcd62d @povik add test_sage.py to tests executed by setup.py if sage is installed; …
povik authored
169
90c29fc @Imran31 Raise KeyboardInterrupts during tests after printing test report
Imran31 authored
170 try:
2c16a21 @Imran31 Raise KeyboardInterrupts during tests after printing test report
Imran31 authored
171 if not sympy.test():
90c29fc @Imran31 Raise KeyboardInterrupts during tests after printing test report
Imran31 authored
172 # some regular test fails, so set the tests_successful
173 # flag to false and continue running the doctests
2c16a21 @Imran31 Raise KeyboardInterrupts during tests after printing test report
Imran31 authored
174 tests_successful = False
90c29fc @Imran31 Raise KeyboardInterrupts during tests after printing test report
Imran31 authored
175
176 if not sympy.doctest():
177 tests_successful = False
178
1e9c98c @Anxuiz Fix commented-out tests.
Anxuiz authored
179 print
a708520 @Anxuiz Test examples when running setup.py test
Anxuiz authored
180 sys.path.append("examples")
1e9c98c @Anxuiz Fix commented-out tests.
Anxuiz authored
181 from all import run_examples # examples/all.py
182 if not run_examples(quiet=True):
90c29fc @Imran31 Raise KeyboardInterrupts during tests after printing test report
Imran31 authored
183 tests_successful = False
184
17baadc @vperic setup.py: skip Sage tests under Python 3
vperic authored
185 if not (sys.platform == "win32" or sys.version_info[0] == 3):
186 # run Sage tests; Sage currently doesn't support Windows or Python 3
199429c @povik don't check for Sage on Windows
povik authored
187 dev_null = open(os.devnull, 'w')
188 if subprocess.call("sage -v", shell = True, stdout = dev_null, stderr = dev_null) == 0:
189 if subprocess.call("sage -python bin/test sympy/external/tests/test_sage.py", shell = True) != 0:
4dcd62d @povik add test_sage.py to tests executed by setup.py if sage is installed; …
povik authored
190 tests_successful = False
191
90c29fc @Imran31 Raise KeyboardInterrupts during tests after printing test report
Imran31 authored
192 if tests_successful:
193 return
194 else:
195 # Return nonzero exit code
196 sys.exit(1)
197 except KeyboardInterrupt:
198 print
199 print("DO *NOT* COMMIT!")
a18e32e @Imran31 made doctests run even if other tests fail
Imran31 authored
200 sys.exit(1)
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
201
9379e66 @vks remove setup.py gen_doc
vks authored
202
ff8acd7 Let's finally intorduce ./setup.py bench
Kirill Smelkov authored
203 class run_benchmarks(Command):
204 """Runs all SymPy benchmarks"""
205
38eb78b @vks fix some descriptions
vks authored
206 description = "run all benchmarks"
ff8acd7 Let's finally intorduce ./setup.py bench
Kirill Smelkov authored
207 user_options = [] # distutils complains if this is not here.
208
209 def __init__(self, *args):
210 self.args = args[0] # so we can pass it to other classes
211 Command.__init__(self, *args)
212
213 def initialize_options(self): # distutils wants this
214 pass
215
216 def finalize_options(self): # this too
217 pass
218
b65eb0e ./setup.py bench now works correctly!
Kirill Smelkov authored
219 # we use py.test like architecture:
220 #
221 # o collector -- collects benchmarks
222 # o runner -- executes benchmarks
223 # o presenter -- displays benchmarks results
224 #
225 # this is done in sympy.utilities.benchmarking on top of py.test
ff8acd7 Let's finally intorduce ./setup.py bench
Kirill Smelkov authored
226 def run(self):
b65eb0e ./setup.py bench now works correctly!
Kirill Smelkov authored
227 from sympy.utilities import benchmarking
228 benchmarking.main(['sympy'])
ff8acd7 Let's finally intorduce ./setup.py bench
Kirill Smelkov authored
229
230
a59bf5f @certik A script written for automatic generation of a tests list in setup.py.
certik authored
231 # Check that this list is uptodate against the result of the command:
b600841 @mattpap Removed numerics module
mattpap authored
232 # $ python bin/generate_test_list.py
77a6470 make ./setup sdist work again
ondrej.certik authored
233 tests = [
08066ae @vks update setup.py
vks authored
234 'sympy.assumptions.tests',
00126e9 @rlamy Update setup.py to handle sympy.combinatorics and sympy.matrices.expr…
rlamy authored
235 'sympy.combinatorics.tests',
77a6470 make ./setup sdist work again
ondrej.certik authored
236 'sympy.concrete.tests',
2f112ee fixed setup.py and some doctests
ondrej.certik authored
237 'sympy.core.tests',
2215c07 @asmeurer Update setup.py with the new external module
asmeurer authored
238 'sympy.external.tests',
be6103e Improved and cleaned up test_doc in setup.py. exp(-x) now prints as e…
mattpap authored
239 'sympy.functions.combinatorial.tests',
240 'sympy.functions.elementary.tests',
241 'sympy.functions.special.tests',
43196ac @certik galgebra tests added
certik authored
242 'sympy.galgebra.tests',
77a6470 make ./setup sdist work again
ondrej.certik authored
243 'sympy.geometry.tests',
244 'sympy.integrals.tests',
a7083f4 @fabianp Add the logic module (and its tests) to the installation script
fabianp authored
245 'sympy.logic.tests',
00126e9 @rlamy Update setup.py to handle sympy.combinatorics and sympy.matrices.expr…
rlamy authored
246 'sympy.matrices.expressions.tests',
77a6470 make ./setup sdist work again
ondrej.certik authored
247 'sympy.matrices.tests',
e0c88d3 @certik setup.py updated to install mpmath's tests.
certik authored
248 'sympy.mpmath.tests',
77a6470 make ./setup sdist work again
ondrej.certik authored
249 'sympy.ntheory.tests',
d11f053 @certik parsing module added to ./setup.py
certik authored
250 'sympy.parsing.tests',
193e520 @plaes Added tensor and quantum to tests
plaes authored
251 'sympy.physics.quantum.tests',
45ce4e8 Restore Pauli,Dirac matrices & Pauli algebra from old-core,
kirill.smelkov authored
252 'sympy.physics.tests',
2f112ee fixed setup.py and some doctests
ondrej.certik authored
253 'sympy.plotting.tests',
b004d1e @mattpap Another approach to polynomials
mattpap authored
254 'sympy.polys.tests',
85a4874 @certik A missing test added to setup.py
certik authored
255 'sympy.printing.pretty.tests',
77a6470 make ./setup sdist work again
ondrej.certik authored
256 'sympy.printing.tests',
257 'sympy.series.tests',
258 'sympy.simplify.tests',
259 'sympy.solvers.tests',
2f112ee fixed setup.py and some doctests
ondrej.certik authored
260 'sympy.statistics.tests',
193e520 @plaes Added tensor and quantum to tests
plaes authored
261 'sympy.tensor.tests',
77a6470 make ./setup sdist work again
ondrej.certik authored
262 'sympy.utilities.tests',
be6103e Improved and cleaned up test_doc in setup.py. exp(-x) now prints as e…
mattpap authored
263 ]
77a6470 make ./setup sdist work again
ondrej.certik authored
264
b99fa44 @vperic setup.py: Add clasifiers, long_description
vperic authored
265 classifiers = [
266 'License :: OSI Approved :: BSD License',
267 'Operating System :: OS Independent',
268 'Programming Language :: Python',
269 'Topic :: Scientific/Engineering',
270 'Topic :: Scientific/Engineering :: Mathematics',
271 'Topic :: Scientific/Engineering :: Physics',
272 'Programming Language :: Python :: 2',
273 'Programming Language :: Python :: 2.5',
274 'Programming Language :: Python :: 2.6',
275 'Programming Language :: Python :: 2.7',
276 'Programming Language :: Python :: 3',
277 'Programming Language :: Python :: 3.2',
278 ]
279
280 long_description = '''SymPy is a Python library for symbolic mathematics. It aims
281 to become a full-featured computer algebra system (CAS) while keeping the code
282 as simple as possible in order to be comprehensible and easily extensible.
283 SymPy is written entirely in Python and does not require any external libraries.'''
284
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
285 setup(
5009295 Merged matrices. Bug fix in resultant() (made it working for 'sparse'…
mattpap authored
286 name = 'sympy',
287 version = sympy.__version__,
288 description = 'Computer algebra system (CAS) in Python',
b99fa44 @vperic setup.py: Add clasifiers, long_description
vperic authored
289 long_description = long_description,
a13a8b8 @vks fix setup.py
vks authored
290 author = 'SymPy development team',
291 author_email = 'sympy@googlegroups.com',
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
292 license = 'BSD',
b99fa44 @vperic setup.py: Add clasifiers, long_description
vperic authored
293 keywords = "Math CAS",
5009295 Merged matrices. Bug fix in resultant() (made it working for 'sparse'…
mattpap authored
294 url = 'http://code.google.com/p/sympy',
1bbad37 @Krastanov Removing pyglet
Krastanov authored
295 packages = ['sympy'] + modules + tests,
edf81a4 @vks 1783: don't install bin/test, bin/doctest, bin/py.bench
vks authored
296 scripts = ['bin/isympy'],
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
297 ext_modules = [],
3226503 @certik Include *.xsl in the distribution (thanks to Mateusz), fix for #445
certik authored
298 package_data = { 'sympy.utilities.mathml' : ['data/*.xsl'] },
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
299 data_files = [('share/man/man1', ['doc/man/isympy.1'])],
5009295 Merged matrices. Bug fix in resultant() (made it working for 'sparse'…
mattpap authored
300 cmdclass = {'test': test_sympy,
a13a8b8 @vks fix setup.py
vks authored
301 'bench': run_benchmarks,
302 'clean': clean,
26c37e8 @plaes Add audit command to setup.py that checks source code using PyFlakes.
plaes authored
303 'audit' : audit,
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
304 },
b99fa44 @vperic setup.py: Add clasifiers, long_description
vperic authored
305 classifiers = classifiers,
99b21ff Created sympy-merge branch with basic structure of directories, core …
mattpap authored
306 )
Something went wrong with that request. Please try again.