This repository has been archived by the owner on Jun 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
76 lines (58 loc) · 2.3 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
# simple makefile to simplify repetitive build env management tasks under posix
PYTHON ?= python3
PYLINT ?= pylint
MAKE_DBG ?= ""
TESTS ?= tests/
FLAKE ?= flake8
NAME = rascil
IMG ?= $(NAME)
TAG ?= ubuntu18.04
DOCKER_IMAGE = $(IMG):$(TAG)
WORKER_RASCIL_DATA ?= /rascil/data
CURRENT_DIR = $(shell pwd)
JUPYTER_PASSWORD ?= changeme
# RASCIL data directory usualy found in ./data
RASCILDATA = $(CURRENT_DIR)/data
-include PrivateRules.mak
.DEFAULT_GOAL := help
clean: cleantests
$(PYTHON) setup.py clean --all
rm -rf dist
in: inplace # just a shortcut
inplace:
$(PYTHON) setup.py build >/dev/null 2>&1 && $(PYTHON) setup.py install >/dev/null 2>&1 || (echo "'$(PYTHON) setup.py install' failed."; exit -1)
build: in ## build and install this project - make sure pipenv shell is activated
cleantests: ## clean out the cache before tests are run
rm -rf workers-*.dirlock
cd tests && rm -rf __pycache__
unittest: cleantests ## run tests using unittest
MPLBACKEND=agg $(PYTHON) -m unittest -f --locals tests/*/test_*.py
pytest: cleantests ## run tests using pytest
pip install pytest >/dev/null 2>&1
pytest -x $(TESTS)
trailing-spaces:
find rascil/processing_components -name "*.py" -exec perl -pi -e 's/[ \t]*$$//' {} \;
find rascil/workflows -name "*.py" -exec perl -pi -e 's/[ \t]*$$//' {} \;
docs: inplace ## build docs
$(MAKE) -C docs dirhtml
code-flake:
# flake8 ignore long lines and trailing whitespace
$(FLAKE) --ignore=E501,W293,F401 --builtins=ModuleNotFoundError rascil/processing_components rascil/workflows
code-lint:
$(PYLINT) --extension-pkg-whitelist=numpy \
--ignored-classes=astropy.units,astropy.constants,HDUList \
-E rascil/processing_components rascil/workflows tests/
code-analysis: code-flake code-lint ## run pylint and flake8 checks
examples: inplace ## launch examples
$(MAKE) -C rascil/examples/notebooks
$(MAKE) -C rascil/examples/scripts
$(MAKE) -C rascil/examples/skasimulations
docker:
cd docker/rascil-no-data;docker build -t timcornwell/rascil-no-data .
cd docker/rascil-full;docker build -t timcornwell/rascil-full .
docker-no-cache:
cd docker/rascil-no-data;docker build --no-cache -t timcornwell/rascil-no-data .
cd docker/rascil-full;docker build --no-cache -t timcornwell/rascil-full .
docker-push:
docker push timcornwell/rascil-no-data
docker push timcornwell/rascil-full