-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
82 lines (64 loc) · 2.46 KB
/
Makefile
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
# SageMath is needed in path unless we use docker
ifeq (docker,$(findstring docker, $(MAKECMDGOALS)))
DOCKER = 1
endif
ifeq (,$(DOCKER)$(shell which sage))
$(error "No sage in $(PATH). Please install sage first or add the relevant path.")
endif
# Command line arguments:
# Set to 0 to use local source instead of GIT
REMOTE_SRC=1
# Set to desired git branch
GIT_BRANCH=main
# Port for notebook
NBPORT=8888
# Arguments for tox
TOX_ARGS=doctest,coverage,pycodestyle,relint,codespell,flake8
ifeq (0,$(REMOTE_SRC))
TAG=local
GIT_BRANCH=
else
TAG=$(GIT_BRANCH)
endif
EXAMPLES_ARGS:=$(GIT_BRANCH) $(NBPORT)
build:
sage -python setup.py build_ext --inplace $* 2>&1
sdist:
sage -python setup.py sdist
install:
sage -python setup.py install
test:
sage -t src/*
examples:
sage -n jupyter --no-browser --ip='0.0.0.0' --port=$(NBPORT)\
--notebook-dir=examples\
--NotebookApp.custom_display_url=http://127.0.0.1:$(NBPORT)\
--NotebookApp.use_redirect_file=False\
--NotebookApp.browser=x-www-browser
tox:
sage -pip install tox meson
sage --python -m tox -c tox.ini -e $(TOX_ARGS)
docker:
docker build --build-arg GIT_BRANCH=$(GIT_BRANCH) --build-arg REMOTE_SRC=$(REMOTE_SRC) -t hilbertmodgroup-$(TAG) .
docker-rebuild:
docker build --build-arg GIT_BRANCH=$(GIT_BRANCH) --build-arg REMOTE_SRC=$(REMOTE_SRC) --no-cache -t hilbertmodgroup-$(TAG) .
docker-test: docker
docker run --platform linux/amd64 -it -e GIT_BRANCH=$(GIT_BRANCH) --init hilbertmodgroup-$(TAG) test
docker-examples: docker
docker run --platform linux/amd64 -p $(NBPORT):$(NBPORT) -it -e GIT_BRANCH=$(GIT_BRANCH) -e NBPORT=$(NBPORT) --init hilbertmodgroup-$(TAG) examples $(EXAMPLES_ARGS)
docker-tox: docker
docker run --platform linux/amd64 -it -e GIT_BRANCH=$(GIT_BRANCH) -e TOX_ARGS=$(TOX_ARGS) --init hilbertmodgroup-$(TAG) tox
docker-shell: docker
docker run --platform linux/amd64 -it -e GIT_BRANCH=$(GIT_BRANCH) --init hilbertmodgroup-$(TAG) shell
docker-sage: docker
docker run --platform linux/amd64 -it -e GIT_BRANCH=$(GIT_BRANCH) --init hilbertmodgroup-$(TAG) run
clean:
rm -rf src/hilbert_modgroup/*.c
rm -rf src/hilbert_modgroup/*.so
rm -rf src/hilbert_modgroup/*.cpp
rm -rf hilbert_modular_group.egg-info
rm -rf build
rm -rf dist
rm -rf Library
.PHONY: build sdist install test examples clean shell tox docker docker-examples docker-examples docker-rebuild \
docker-shell docker-test docker-tox