-
-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathMakefile
More file actions
179 lines (143 loc) · 5.31 KB
/
Makefile
File metadata and controls
179 lines (143 loc) · 5.31 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# A GNU Makefile to run various tasks - compatibility for us old-timers.
# Note: This makefile include remake-style target comments.
# These comments before the targets start with #:
# remake --tasks to shows the targets and the comments
GIT2CL ?= admin-tools/git2cl
PYTHON ?= python3
PIP ?= pip3
BASH ?= bash
RM ?= rm
PYTEST_OPTIONS ?=
DOCTEST_OPTIONS ?=
# Variable indicating Mathics3 Modules you have available on your system, in latex2doc option format
MATHICS3_MODULE_OPTION ?= --load-module pymathics.graph,pymathics.natlang
.PHONY: \
all \
benchmarks \
build \
check \
check-builtin-manifest \
check-consistency-and-style \
check-full \
clean \
clean-cache \
clean-cython \
develop \
develop-full \
develop-full-cython \
dist \
doc \
doctest \
doctest-data \
djangotest \
gstest \
latexdoc \
mypy \
plot-detailed-tests\
pytest \
pytest-x \
rmChangeLog \
test \
texdoc
MATHICS3_SANDBOX ?=
ifeq ($(OS),Windows_NT)
MATHICS3_SANDBOX = t
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
MATHICS3_SANDBOX = t
endif
endif
#: Default target - same as "develop"
all: develop
# run pytest benchmarks
benchmarks:
BENCHMARKS=True $(PYTHON) -m pytest $(PYTEST_OPTIONS) test/timings
#: build everything needed to install
build:
$(PYTHON) ./setup.py build
# Note that we need ./setup.py develop
# because pip install doesn't handle
# INSTALL_REQUIRES properly
#: Set up to run from the source tree
develop: mathics_scanner/data/boxing-characters.json mathics_scanner/data/named-characters.json mathics_scanner/data/operators.json
$(PIP) install -e .[dev]
# See note above on ./setup.py
#: Set up to run from the source tree with full dependencies
develop-full: mathics_scanner/data/boxing-characters.json mathics_scanner/data/named-characters.json mathics_scanner/data/operators.json
$(PIP) install -e .[dev,full]
# See note above on ./setup.py
#: Set up to run from the source tree with full dependencies and Cython
develop-full-cython: mathics_scanner/data/boxing-characters.json mathics_scanner/data/named-characters.json mathics_scanner/data/operators.json
$(PIP) install -e .[dev,full,cython]
#: Make distribution: wheels, eggs, tarball
dist:
./admin-tools/make-dist.sh
#: Install Mathics
install:
$(PYTHON) setup.py install
#: Run the most extensive set of tests
check: pytest gstest doctest
#: Run the most extensive set of tests, stopping on first error
check-x: pytest-x gstest doctest-x plot-detailed-tests
#: Run the most extensive set of tests
check-for-Windows: pytest-for-windows gstest doctest
#: Build and check manifest of Builtins
check-builtin-manifest:
$(PYTHON) admin-tools/build_and_check_manifest.py
#: Run pytest consistency and style checks
check-consistency-and-style:
MATHICS_LINT=t $(PYTHON) -m pytest $(PYTEST_OPTIONS) test/consistency-and-style
check-full: check-builtin-manifest check-builtin-manifest check plot-detailed-tests
#: Remove Cython-derived files
clean-cython:
find mathics -name "*.so" -type f -delete; \
find mathics -name "*.c" -type f -delete
#: Remove Python cache files
clean-cache:
find mathics -name *.py[co] -type f -delete; \
find mathics -name __pycache__ -type d -delete || true
#: Remove derived files
clean: clean-cython clean-cache
for dir in mathics/doc ; do \
($(MAKE) -C "$$dir" clean); \
done; \
rm -f factorials || true; \
rm -f mathics/data/*.json || true; \
rm -rf build || true
mypy:
mypy --install-types --ignore-missing-imports --non-interactive mathics
plot-detailed-tests:
MATHICS_CHARACTER_ENCODING="ASCII" MATHICS_PLOT_DETAILED_TESTS="1" $(PYTHON) -m pytest -x $(PYTEST_OPTIONS) test/builtin/drawing/test_plot_detail.py
#: Run pytest tests. Use environment variable "PYTEST_OPTIONS" for pytest options
pytest:
MATHICS_CHARACTER_ENCODING="ASCII" $(PYTHON) -m pytest $(PYTEST_OPTIONS) $(PYTEST_WORKERS) test
#: Run pytest tests stopping at first failure.
pytest-x :
PYTEST_OPTIONS="-x" $(MAKE) pytest
#: Run a more extensive pattern-matching test
gstest:
(cd examples/symbolic_logic/gries_schneider && $(PYTHON) test_gs.py)
#: Create doctest test data and test results that is used to build LaTeX PDF
# For LaTeX docs we assume Unicode
doctest-data: mathics/builtin/*.py mathics/doc/documentation/*.mdoc mathics/doc/documentation/images/*
MATHICS_CHARACTER_ENCODING="UTF-8" $(PYTHON) mathics/docpipeline.py --output --keep-going $(MATHICS3_MODULE_OPTION)
#: Run tests that appear in docstring in the code. Use environment variable "DOCTEST_OPTIONS" for doctest options
doctest:
MATHICS_CHARACTER_ENCODING="ASCII" MATHICS3_SANDBOX=$(MATHICS3_SANDBOX) $(PYTHON) mathics/docpipeline.py $(DOCTEST_OPTIONS)
#: Run tests that appear in docstring in the code, stopping on the first error.
doctest-x:
DOCTEST_OPTIONS="-x" $(MAKE) doctest
#: Make Mathics PDF manual via Asymptote and LaTeX
latexdoc texdoc doc:
(cd mathics/doc/latex && $(MAKE) doc)
#: Build JSON ASCII to unicode opcode table and operator table
mathics_scanner/data/boxing-characters.json mathics_scanner/data/named-characters.json mathics_scanner/data/operators.json:
$(BASH) ./admin-tools/make-JSON-tables.sh
#: Remove ChangeLog
rmChangeLog:
$(RM) ChangeLog || true
#: Create a ChangeLog from git via git log and git2cl
ChangeLog: rmChangeLog
git log --pretty --numstat --summary | $(GIT2CL) >$@
patch ChangeLog < ChangeLog-spell-corrected.diff