-
-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathsetup.py
More file actions
114 lines (88 loc) · 2.85 KB
/
setup.py
File metadata and controls
114 lines (88 loc) · 2.85 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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Python Setuptools for Mathics3 core
For the easiest installation:
pip install -e .
For full installation:
pip install -e .[full]
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 available commands, read the output of:
python setup.py --help-commands
"""
import logging
import os
import os.path as osp
import platform
import sys
from typing import List
from setuptools import Extension, setup
log = logging.getLogger(__name__)
is_PyPy = platform.python_implementation() == "PyPy" or hasattr(
sys, "pypy_version_info"
)
def get_srcdir():
filename = osp.normcase(osp.dirname(osp.abspath(__file__)))
return osp.realpath(filename)
DEPENDENCY_LINKS: List[str] = []
# "http://github.com/Mathics3/mathics-scanner/tarball/master#egg=Mathics_Scanner-1.0.0.dev"
# ]
# What should be run through Cython?
EXTENSIONS = []
CMDCLASS = {}
try:
if is_PyPy:
raise ImportError
from Cython.Distutils import build_ext # type: ignore[import-not-found]
except ImportError:
pass
else:
if os.environ.get("USE_CYTHON", False):
log.info("Running Cython over code base")
EXTENSIONS_DICT = {
"core": (
"expression",
"symbols",
"number",
"rules",
"pattern",
),
"builtin": [
"arithmetic",
"patterns/basic",
"patterns/composite",
"patterns/defaults",
"patterns/restrictions",
"patterns/rules",
"graphics",
],
"eval": ("nevaluator", "test"),
}
EXTENSIONS = [
Extension(
f"mathics.{parent}.{module}".replace("/", "."),
["mathics/%s/%s.py" % (parent, module)],
)
for parent, modules in EXTENSIONS_DICT.items()
for module in modules
]
# EXTENSIONS_SUBDIR_DICT = {
# "builtin": [("numbers", "arithmetic"), ("numbers", "numeric"), ("drawing", "graphics")],
# }
# EXTENSIONS.append(
# Extension(
# "mathics.%s.%s.%s" % (parent, module[0], module[1]), ["mathics/%s/%s/%s.py" % (parent, module[0], module[1])]
# )
# for parent, modules in EXTENSIONS_SUBDIR_DICT.items()
# for module in modules
# )
CMDCLASS = {"build_ext": build_ext}
setup(
ext_modules=EXTENSIONS,
dependency_links=DEPENDENCY_LINKS,
# don't pack Mathics3 in egg because of media files, etc.
zip_safe=False,
)