4 Development Status :: 3 - Alpha
5 Intended Audience :: Science/Research
6 License :: OSI Approved
7 Programming Language :: Python
8 Topic :: Scientific/Engineering
9 Topic :: Software Development
10 Operating System :: Microsoft :: Windows
11 Operating System :: POSIX
12 Operating System :: Unix
13 Operating System :: MacOS
17 if os
.path
.exists('MANIFEST'): os
.remove('MANIFEST')
19 from distutils
.core
import Extension
, Command
20 from distutils
.command
.build_py
import build_py
as _build_py
22 expr_ext
= Extension('sympycore.expr_ext',
23 sources
= [os
.path
.join('src','expr_ext.c')],
26 combinatorics_ext
= Extension('sympycore.arithmetic.combinatorics',
27 sources
= [os
.path
.join('sympycore','arithmetic','combinatorics.c')],
30 extensions
= [expr_ext
,
34 packages
= ['sympycore',
36 'sympycore.arithmetic',
37 'sympycore.arithmetic.mpmath',
38 'sympycore.arithmetic.mpmath.calculus',
39 'sympycore.arithmetic.mpmath.functions',
40 'sympycore.arithmetic.mpmath.libmp',
41 'sympycore.arithmetic.mpmath.matrices',
42 'sympycore.basealgebra',
44 'sympycore.calculus.functions',
45 'sympycore.functions',
49 'sympycore.polynomials',
51 'sympycore.physics.sysbio',
56 packages
+= [p
+'.tests' for p
in packages \
57 if os
.path
.exists(os
.path
.join(p
.replace('.', os
.sep
), 'tests'))]
59 class tester(Command
):
60 description
= "run sympycore tests"
61 user_options
= [('nose-args=', 'n', 'arguments to nose command'),
62 ('with-coverage', 'c', 'use nose --with-coverage flag'),
63 ('cover-package=', None, 'use nose --cover-package flag'),
64 ('detailed-errors', 'd', 'use nose --detailed-errors flag'),
65 ('nocapture', 's', 'use nose --nocapture flag'),
66 ('nose-verbose', 'v', 'use nose --verbose flag'),
67 ('match=', 'm', 'use nose --match flag'),
68 ('profile', 'p', 'use nose --profile flag'),
69 ('with-doctest', None, 'use nose --with-doctest flag'),
70 ('stop', 'x', 'use nose --stop flag')
72 def initialize_options(self
):
74 self
.with_coverage
= None
75 self
.cover_package
= None
76 self
.detailed_errors
= None
78 self
.nose_verbose
= None
81 self
.with_doctest
= None
84 def finalize_options (self
):
85 if self
.nose_args
is None:
87 if self
.with_coverage
:
88 self
.nose_args
+= ' --with-coverage'
89 if self
.cover_package
:
90 if not self
.with_coverage
:
91 self
.nose_args
+= ' --with-coverage'
92 self
.nose_args
+= ' --cover-package=%s' % self
.cover_package
93 elif self
.with_coverage
:
94 self
.nose_args
+= ' --cover-package=sympycore'
95 if self
.detailed_errors
:
96 self
.nose_args
+= ' --detailed-errors'
98 self
.nose_args
+= ' --nocapture'
100 self
.nose_args
+= ' --verbose'
102 self
.nose_args
+= ' --match=%r' % (self
.match
)
104 self
.nose_args
+= ' --with-profile'
105 if self
.with_doctest
:
106 self
.nose_args
+= ' --with-doctest'
108 self
.nose_args
+= ' --stop'
112 sympycore
.test(nose_args
=self
.nose_args
)
114 class build_py(_build_py
):
116 def find_data_files (self
, package
, src_dir
):
118 files
= _build_py
.find_data_files(self
, package
, src_dir
)
120 if package
=='sympycore':
121 revision
= self
._get
_svn
_revision
(src_dir
)
122 if revision
is not None:
123 target
= os
.path
.join(src_dir
, '__svn_version__.py')
124 print 'Creating ', target
126 f
.write('version = %r\n' % (str(revision
)))
129 def rm_file(f
=target
):
130 try: os
.remove(f
); print 'Removed ',f
132 try: os
.remove(f
+'c'); print 'Removed ',f
+'c'
134 atexit
.register(rm_file
)
137 if package
=='sympycore.arithmetic.mpmath':
138 f
= os
.path
.join(src_dir
, 'REVISION')
139 if os
.path
.isfile(f
):
144 def _get_svn_revision(self
, path
):
145 """Return path's SVN revision number.
151 sin
, sout
= os
.popen4('svnversion')
152 m
= re
.match(r
'(?P<revision>\d+)', sout
.read())
156 revision
= int(m
.group('revision'))
158 if sys
.platform
=='win32' and os
.environ
.get('SVN_ASP_DOT_NET_HACK',None):
159 entries
= os
.path
.join(path
,'_svn','entries')
161 entries
= os
.path
.join(path
,'.svn','entries')
162 if os
.path
.isfile(entries
):
166 if fstr
[:5] == '<?xml': # pre 1.4
167 m
= re
.search(r
'revision="(?P<revision>\d+)"',fstr
)
169 revision
= int(m
.group('revision'))
170 else: # non-xml entries file --- check to be sure that
171 m
= re
.search(r
'dir[\n\r]+(?P<revision>\d+)', fstr
)
173 revision
= int(m
.group('revision'))
177 if __name__
== '__main__':
178 from distutils
.core
import setup
179 setup(name
='sympycore',
181 author
= 'Pearu Peterson, Fredrik Johansson',
182 author_email
= 'sympycore@googlegroups.com',
183 license
= 'http://sympycore.googlecode.com/svn/trunk/LICENSE',
184 url
= 'http://sympycore.googlecode.com',
185 download_url
= 'http://code.google.com/p/sympycore/downloads/',
186 classifiers
=filter(None, CLASSIFIERS
.split('\n')),
187 description
= 'SympyCore: an efficient pure Python Computer Algebra System',
188 long_description
= '''\
189 SympyCore project provides a pure Python package sympycore for
190 representing symbolic expressions using efficient data structures as
191 well as methods to manipulate them. Sympycore uses a clear algebra
192 oriented design that can be easily extended.
196 ext_modules
= extensions
,
197 package_dir
= {'sympycore': 'sympycore'},
198 cmdclass
=dict(test
=tester
, build_py
=build_py
)