forked from mathics/Mathics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
164 lines (126 loc) · 4.98 KB
/
setup.py
File metadata and controls
164 lines (126 loc) · 4.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/usr/bin/env python
"""Setuptools based setup script for Mathics.
For the easiest installation just type the following command (you'll probably
need root privileges):
python setup.py install
This will install the library in the default location. For instructions on
how to customize the install procedure read the output of:
python setup.py --help install
In addition, there are some other commands:
python setup.py clean -> will clean all trash (*.pyc and stuff)
To get a full list of avaiable commands, read the output of:
python setup.py --help-commands
Or, if all else fails, feel free to write to the sympy list at
mathics-users@googlegroups.com and ask for help.
"""
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup
from distutils.core import Command
from distutils.extension import Extension
import sys
# Ensure user has the correct Python version
if not (2,5) <= sys.version_info[:2] <= (2,7):
print("Mathics supports Python 2.5 upto Python 2.7. Python %d.%d detected" % sys.version_info[:2])
sys.exit(-1)
from mathics import settings
if sys.subversion[0] == 'PyPy':
is_PyPy = True
else:
is_PyPy = False
try:
if is_PyPy:
raise ImportError
from Cython.Distutils import build_ext
except ImportError:
EXTENSIONS = []
CMDCLASS = {}
INSTALL_REQUIRES = []
else:
EXTENSIONS = {
'core': ['expression', 'numbers', 'rules', 'pattern'],
'builtin': ['arithmetic', 'numeric', 'patterns', 'graphics']
}
EXTENSIONS = [Extension('mathics.%s.%s' % (parent, module),
['mathics/%s/%s.py' % (parent, module)]) for parent, modules in EXTENSIONS.iteritems() for module in modules]
CMDCLASS = {'build_ext': build_ext}
INSTALL_REQUIRES = ['cython>=0.15.1']
# General Requirements
INSTALL_REQUIRES += ['sympy==0.7.2', 'mpmath>=0.15', 'django>=1.2', 'ply>=3.4',
'argparse', 'python-dateutil', 'colorama']
# strange SandboxError with SymPy 0.6.7 in Sage (writing to ~/.sage/tmp)
#if sys.platform == "darwin":
# INSTALL_REQUIRES += ['readline']
def subdirs(root, file='*.*', depth=10):
for k in range(depth):
yield root + '*/' * k + file
class initialize(Command):
"""
Creates the database used by Django
"""
description = "create the database used by django"
user_options = [] # distutils complains if this is not here.
def __init__(self, *args):
self.args = args[0] # so we can pass it to other classes
Command.__init__(self, *args)
def initialize_options(self): # distutils wants this
pass
def finalize_options(self): # this too
pass
def run(self):
import os
import subprocess
database_file = settings.DATABASES['default']['NAME']
print("Creating data directory %s" % settings.DATA_DIR)
if not os.path.exists(settings.DATA_DIR):
os.makedirs(settings.DATA_DIR)
print("Creating database %s" % database_file)
subprocess.call([sys.executable, 'mathics/manage.py', 'syncdb', '--noinput'])
os.chmod(database_file, 0o766)
print("")
print("Mathics initialized successfully.")
CMDCLASS['initialize'] = initialize
mathjax_files = list(subdirs('media/js/mathjax/'))
setup(
name = "Mathics",
cmdclass = CMDCLASS,
ext_modules = EXTENSIONS,
version = settings.VERSION,
packages = [
'mathics',
'mathics.core',
'mathics.builtin', 'mathics.builtin.pymimesniffer', 'mathics.data',
'mathics.doc',
'mathics.autoload',
'mathics.packages',
'mathics.web', 'mathics.web.templatetags'
],
install_requires = INSTALL_REQUIRES,
package_data = {
'mathics.doc': ['documentation/*.mdoc', 'xml/data'],
'mathics.web': ['media/css/*.css', 'media/img/*.gif',
'media/js/innerdom/*.js', 'media/js/prototype/*.js',
'media/js/scriptaculous/*.js', 'media/js/three/Three.js',
'media/js/three/Detector.js', 'media/js/*.js', 'templates/*.html',
'templates/doc/*.html'] + mathjax_files,
'mathics.data': ['*.csv', 'ExampleData/*'],
'mathics.builtin.pymimesniffer': ['mimetypes.xml'],
'mathics.autoload': ['formats/*/Import.m', 'formats/*/Export.m'],
'mathics.packages': ['*/*.m', '*/Kernel/init.m'],
},
entry_points = {
'console_scripts': [
'mathics = mathics.main:main',
'mathicsserver = mathics.server:main',
],
},
zip_safe = False, # don't pack Mathics in egg file because of sqlite database, media files, etc.
# metadata for upload to PyPI
author = "Jan Poeschko",
author_email = "jan@poeschko.com",
description = "A general-purpose computer algebra system.",
license = "GPL",
keywords = "computer algebra system mathics mathematica sage sympy",
url = "http://www.mathics.org/", # project home page, if any
# TODO: could also include long_description, download_url, classifiers, etc.
)