-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
103 lines (85 loc) · 2.9 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
# CI sets MAJOR.MINOR.PATCH for git tags
NOCOLAB ?= 0
DEBNAME ?= ont-epi2melabs-launcher
ifeq ($(NOCOLAB), 0)
PROJECT = $(DEBNAME)
CONFLICTPROJECT = $(DEBNAME)-jupyter
else
PROJECT = $(DEBNAME)-jupyter
CONFLICTPROJECT = $(DEBNAME)
endif
MAJOR ?= 0
MINOR ?= 0
SUB ?= 0
PATCH ?= 0
VERSION = "$(MAJOR).$(MINOR).$(SUB)"
CODENAME ?= $(shell awk -F= '/CODENAME/{print $$2}' /etc/lsb-release)
DEB = "$(PROJECT)-$(MAJOR).$(MINOR).$(SUB)-$(PATCH)~$(CODENAME).deb"
MD5SUM = md5sum
SEDI = sed -i
PYTHON ?= python
VENV = venv/bin/activate
PYQT5SIP = $(shell grep pyqt5-sip requirements.txt)
PYWINTYPES=
PYINSTALLERARGS=
ifeq ($(shell uname), Darwin)
MD5SUM = md5 -r
SEDI = sed -i ""
PYINSTALLERARGS = ""
endif
# this is unused, see winbuild.ps1
ifneq (,$(findstring MINGW64,$(shell uname)))
VENV = venv/Scripts/activate
PYWINTYPES = pypiwin32
endif
IN_VENV=. ./$(VENV)
$(VENV):
@echo Project: $(PROJECT)
@echo Conflicts project: $(CONFLICTPROJECT)
@echo Shell: "'"$(shell uname)"'"
@echo
test -d venv || virtualenv venv --python=$(PYTHON) --prompt "(build) "
${IN_VENV} && pip install pip --upgrade
${IN_VENV} && pip install ${PYQT5SIP} ${PYWINTYPES}
${IN_VENV} && pip install -r requirements.txt
testenv: $(VENV)
test: $(VENV)
${IN_VENV} && pip install flake8 flake8-rst-docstrings flake8-docstrings flake8-import-order
${IN_VENV} && flake8 labslauncher \
--import-order-style google --application-import-names labslauncher \
--statistics
dist/EPI2ME-Labs-Launcher: $(VENV)
${IN_VENV} && python setup.py develop
${IN_VENV} && pyinstaller EPI2ME-Labs-Launcher.spec ${PYINSTALLERARGS}
.PHONY: run
run: $(VENV)
${IN_VENV} && python setup.py develop && labslauncher
.PHONY: build
build: dist/EPI2ME-Labs-Launcher
.PHONY: clean
clean:
rm -rf __pycache__ dist build venv labslauncher.egg-info tmp *.deb
deb: clean dist/EPI2ME-Labs-Launcher
echo $(PROJECT)
echo $(CONFLICTPROJECT)
rm -rf deb-src/usr
mkdir -p deb-src/usr/local/bin
mkdir -p deb-src/usr/share/applications
cp -r dist/EPI2ME-Labs-Launcher deb-src/usr/local/bin/
cp labslauncher.desktop deb-src/usr/share/applications
cp labslauncher/epi2me.png deb-src/usr/share/applications/epi2me.png
cp -rp deb-src/ tmp/
$(SEDI) "s/CONFLICTPROJECT/$(CONFLICTPROJECT)/g" tmp/DEBIAN/control
$(SEDI) "s/PROJECT/$(PROJECT)/g" tmp/DEBIAN/control
$(SEDI) "s/MAJOR/$(MAJOR)/g" tmp/DEBIAN/control
$(SEDI) "s/MINOR/$(MINOR)/g" tmp/DEBIAN/control
$(SEDI) "s/SUB/$(SUB)/g" tmp/DEBIAN/control
$(SEDI) "s/PATCH/$(PATCH)/g" tmp/DEBIAN/control
$(SEDI) "s/CODENAME/$(CODENAME)/g" tmp/DEBIAN/control
$(SEDI) "s/STREAM/$(STREAM)/g" tmp/DEBIAN/control
find tmp -type f ! -regex '.*\(\bDEBIAN\b\|\bdeb-src\b\|\).*' -exec $(MD5SUM) {} \; | sed 's/tmp\///' > tmp/DEBIAN/md5sums
chmod -R 755 tmp/DEBIAN
chmod 644 tmp/DEBIAN/md5sums
(cd tmp; fakeroot dpkg -b . ../$(DEB))
dpkg -I $(DEB)
dpkg -c $(DEB)