-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
120 lines (95 loc) · 4.06 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
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
.PHONY: clean clean-demo install inplace-install install-venv install-requirements \
guirc check setupcheck test testall test-coverage lint \
changelint manualrelease release help
PODMAN_OR_DOCKER = $(shell which podman || which docker || \
echo podman_or_docker 2>/dev/null)
SHELL=/bin/bash
RCC5 = pyrcc5
RCC6 = /usr/lib64/qt6/libexec/rcc
PYTHON = /usr/bin/env python3
nicos/guisupport/gui_rc_qt5.py: resources/nicos-gui.qrc
-$(RCC5) -o $@ $<
nicos/guisupport/gui_rc_qt6.py: resources/nicos-gui.qrc
-$(RCC6) -g python $< | sed s,PySide6,PyQt6, > $@
guirc: nicos/guisupport/gui_rc_qt5.py nicos/guisupport/gui_rc_qt6.py
pod-demo:
$(PODMAN_OR_DOCKER) run -u `id -u` -v `pwd`:/nicos -p 1301:1301 \
--rm -it quay.io/cfelder/nicos:latest
clean:
rm -rf build
find . -name '__pycache__' -exec rm -rf {} \;
rm -rf test/root/
clean-demo: clean
-rm -rf data/cache/*
-rm -rf data/logbook data/20*
-rm -rf log/poller* log/cache log/daemon log/elog log/nicos log/watchdog
-rm -f data/current
install:
@echo "Installing to $(DESTDIR)$(PREFIX)..."
@echo
@if [ -z "$(PREFIX)" ]; then echo "PREFIX is empty! Do not run make install on instruments"; exit 1; fi
mkdir -p $(DESTDIR)$(PREFIX)
$(PYTHON) setup.py install --prefix=$(PREFIX) \
$(and $(DESTDIR),--root=$(DESTDIR)) \
$(and $(INSTRUMENT),--instrument=$(INSTRUMENT)) \
$(and $(SETUPPACKAGE), --setup-package=$(SETUPPACKAGE)) \
$(and $(INSTALL_LAYOUT), --install-layout=$(INSTALL_LAYOUT))
inplace-install:
-ln -sf -t /etc/init.d "$$(pwd)/etc/nicos-system"
-ln -sf -t /usr/bin "$$(pwd)"/bin/*
install-venv:
if [ -z "$(VENVNAME)" ]; then export VENVNAME=nicos-venv ; fi; \
if [ -z "$(USEPYTHON)" ]; then export USEPYTHON=`which python3`; fi; \
echo "Installing into venv: $(DESTDIR)$${VENVNAME}"; \
echo "using $${USEPYTHON}"; \
$${USEPYTHON} -m venv --copies --system-site-packages $(DESTDIR)$${VENVNAME}; \
. $(DESTDIR)$${VENVNAME}/bin/activate; \
pip install -U pip ; \
pip install -r requirements.txt ; \
python setup.py install
install-requirements:
@echo "Trying to install up-to-date requirements using pip"
@echo "If something goes wrong, try updating by hand, maybe you need root privileges"
@echo "Updating pip..."
pip install -U pip
@echo "Install requirements"
pip install -r requirements.txt
check:
$(PYTHON) tools/check-setups $(CHECK_DIRS)
setupcheck:
@$(PYTHON) tools/check-setups -s $(shell find . -mindepth 3 -type d -name setups) $(shell find . -name guiconfig.py)
T = test
test:
@$(PYTHON) -m pytest -v $(T) --ignore test/test_stresstest $(O)
testall:
@$(PYTHON) -m pytest -v $(T) $(O)
test-coverage:
@COVERAGE_PROCESS_START=.coveragerc \
$(PYTHON) -m pytest -v $(T) --cov --cov-report=html --cov-report=term $(O)
lint:
@-PYTHONPATH=.:${PYTHONPATH} pylint --rcfile=./pylintrc nicos/ nicos_*/ nicostools/ tools/* bin/*
changelint:
@PYFILESCHANGED=$$(git diff --name-only --diff-filter=dux HEAD^...HEAD | grep "\.py$$" | grep -v setups) ; \
if [[ -n "$$PYFILESCHANGED" ]]; then \
PYTHONPATH=.:${PYTHONPATH} pylint --rcfile=./pylintrc $$PYFILESCHANGED; \
else echo 'no python files changed'; fi
manualrelease: test release
release:
cd doc; rm -rf build/html; ${MAKE} html
$(PYTHON) setup.py sdist
help:
@echo "Important targets:"
@echo " install - install to $(DESTDIR)$(PREFIX)"
@echo " inplace-install - create links from /usr/bin and /etc/init.d to here"
@echo " install-venv - install into a Python virtual environment"
@echo
@echo "Development targets:"
@echo " pod-demo - start nicos-demo pod using podman or docker"
@echo " clean-demo - clean up files created by nicos-demo"
@echo " setupcheck - run setup checks"
@echo " test - run test suite"
@echo " test-coverage - run test suite with coverage reporting"
@echo " lint - check source with pylint"
@echo " changelint - check source with pylint (only files in last commit)"
@echo " manualrelease - create tarball for official release (for manual usage)"
@echo " release - create tarball for official release(jenkins usage)"