-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
134 lines (111 loc) · 3.02 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
.DEFAULT_GOAL := all
VERSION := $(shell grep -m 1 version pyproject.toml | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3)
PACKAGE := $(shell grep -m 1 name pyproject.toml | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3)
OBJ := $(shell find ${PACKAGE} -type f)
OBJ += requirements.txt
OBJ += pyproject.toml
OBJ += README.md
define PLATFORM_SCRIPT
from sysconfig import get_platform
print(get_platform().replace('-', '_'), end="")
endef
export PLATFORM_SCRIPT
PLATFORM := $(shell python -c "$$PLATFORM_SCRIPT")
define ABI_SCRIPT
def main():
try:
from wheel.pep425tags import get_abi_tag
print(get_abi_tag(), end="")
return
except ModuleNotFoundError:
pass
try:
from wheel.vendored.packaging import tags
except ModuleNotFoundError:
from packaging import tags
name=tags.interpreter_name()
version=tags.interpreter_version()
print(f"{name}{version}", end="")
main()
endef
export ABI_SCRIPT
ABI := $(shell python -c "$$ABI_SCRIPT")
clean:
if [ -d .venv/mnt ] && mountpoint -q .venv/mnt; then \
umount -ql .venv/mnt; \
fi
git clean --force -dX
build: wheel
release: wheel sdist
install: wheel
if type pipx > /dev/null; then \
pipx install \
--force \
dist/${PACKAGE}-${VERSION}-${ABI}-${ABI}-${PLATFORM}.whl; \
else \
pip install \
--user \
--force-reinstall \
--no-index \
--find-links=dist \
${PACKAGE}; \
fi
sdist: dist/${PACKAGE}-${VERSION}.tar.gz
wheel: dist/${PACKAGE}-${VERSION}-${ABI}-${ABI}-${PLATFORM}.whl
dist:
mkdir -p dist
dist/${PACKAGE}-${VERSION}.tar.gz: dist $(OBJ)
python -m build --sdist
dist/${PACKAGE}-${VERSION}-${ABI}-${ABI}-${PLATFORM}.whl: dist $(OBJ)
python -m build --wheel
dist/rmuwifuse: dist .venv/bin/activate $(OBJ)
. .venv/bin/activate; \
python -m pip install --extra-index-url=https://wheels.eeems.codes/ wheel nuitka; \
NUITKA_CACHE_DIR="$(realpath .)/.nuitka" \
nuitka3 \
--enable-plugin=pylint-warnings \
--enable-plugin=upx \
--warn-implicit-exceptions \
--onefile \
--lto=yes \
--assume-yes-for-downloads \
--python-flag=-m \
--remove-output \
--output-dir=dist \
--output-filename=rmuwifuse \
remarkable_usb_web_interface_fuse
.venv/bin/activate: requirements.txt
@echo "Setting up development virtual env in .venv"
python -m venv .venv
. .venv/bin/activate; \
python -m pip install --extra-index-url=https://wheels.eeems.codes/ -r requirements.txt
dev: .venv/bin/activate $(OBJ)
if [ -d .venv/mnt ] && mountpoint -q .venv/mnt; then \
umount -ql .venv/mnt; \
fi
mkdir -p .venv/mnt
. .venv/bin/activate; \
python -m remarkable_usb_web_interface_fuse \
-d \
-f \
-s \
-o auto_unmount \
10.11.99.1 \
.venv/mnt
test: .venv/bin/activate $(OBJ)
. .venv/bin/activate; \
python test.py
executable: .venv/bin/activate dist/rmuwifuse
dist/rmuwifuse --help
all: release
.PHONY: \
all \
build \
clean \
dev \
executable \
install \
release \
sdist \
wheel \
test