-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsetup.py
More file actions
59 lines (39 loc) · 1.68 KB
/
setup.py
File metadata and controls
59 lines (39 loc) · 1.68 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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""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 available commands, read the output of:
python setup.py --help-commands
Or, if all else fails, feel free to write to the mathics users list at
mathics-users@googlegroups.com and ask for help.
"""
import os
import os.path as osp
from setuptools import setup
from setuptools.command.build_py import build_py as setuptools_build_py
def get_srcdir():
"""Return the directory of the location if this code"""
filename = osp.normcase(osp.dirname(osp.abspath(__file__)))
return osp.realpath(filename)
class build_py(setuptools_build_py):
def run(self):
for table_type in ("boxing-character", "named-character", "operator"):
json_data_file = osp.join("data", f"{table_type}.json")
json_path = osp.join("mathics-scanner", json_data_file)
if not osp.exists(json_path):
os.system(f"mathics3-make-{table_type}-json" " -o {json-path}")
self.distribution.package_data["Mathics-Scanner"].append(json_data_file)
setuptools_build_py.run(self)
CMDCLASS = {"build_py": build_py}
setup(
cmdclass=CMDCLASS,
# don't pack Mathics in egg because of media files, etc.
zip_safe=False,
)