forked from selfcustody/krux-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
172 lines (150 loc) · 5.69 KB
/
Copy pathpyproject.toml
File metadata and controls
172 lines (150 loc) · 5.69 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
[project]
name = "krux-installer"
version = "0.0.23"
description = "A GUI based application to flash Krux firmware on K210 based devices"
authors = [
{name = "qlrd", email = "qlrddev@gmail.com"},
{name = "joaozinhom", email = "joaomcr@proton.me"}
]
license = {text = "MIT"}
readme = "README.md"
requires-python = ">3.10,<=3.14.3"
dependencies = [
"kivy==2.3.1",
"pyserial>=3.5",
"easy-i18n>=1.2.0",
"pysudoer @ git+https://github.com/qlrd/pysudoer.git@v0.0.3",
"pyinstaller>=6.21.0",
"pygame>=2.6.1",
]
[project.optional-dependencies]
dev = [
"black>=26.5.1",
"pylint>=4.0.7",
"pytest-cov>=7.1.0",
"poethepoet>=0.48.0",
"demjson3>=3.0.6",
]
builder = [
"cryptography>=50.0.0",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.metadata]
allow-direct-references = true
[dependency-groups]
dev = [
"black>=26.5.1",
"pylint>=4.0.7",
"pytest-cov>=7.1.0",
"poethepoet>=0.48.0",
"demjson3>=3.0.6",
"pymarkdownlnt>=0.9.34"
]
[tool.poe.tasks]
cli = "python src/krux_installer.py"
format-src = "black ./src"
format-tests = "black ./tests"
format-e2e = "black ./e2e"
format-drives = "black ./e2e_drives"
format-installer = "black ./krux_installer.py"
format = [
"format-src",
"format-tests",
"format-e2e",
"format-drives",
"format-installer",
]
fetch-firmware = "bash prebuild/fetch_firmware.sh"
clean = "python .ci/clean.py"
test-unit = "pytest --cache-clear --cov=src/utils/constants --cov=src/utils/info --cov=src/utils/trigger --cov=src/utils/flasher --cov=src/utils/verifyer --cov=src/i18n --cov-branch --cov-report html ./tests"
test-e2e = "pytest --cov-append --cov=src/app --cov-branch --cov-report html ./e2e"
test-drives = "pytest --cov-append --cov=src/app --cov-branch --cov-report html ./e2e_drives"
test = ["test-unit", "test-e2e", "test-drives"]
coverage-unit = "pytest --cache-clear --cov=src/utils/constants --cov=src/utils/info --cov=src/utils/trigger --cov=src/utils/flasher --cov=src/utils/verifyer --cov=src/i18n --cov-branch --cov-report xml ./tests"
coverage-e2e = "pytest --cov-append --cov=src/app --cov-branch --cov-report xml ./e2e"
coverage-drives = "pytest --cov-append --cov=src/app --cov-branch --cov-report xml ./e2e_drives"
coverage = ["coverage-unit", "coverage-e2e", "coverage-drives"]
lint.sequence = [
{ cmd = "pymarkdownlnt -d MD013,MD033,MD036 -e MD024 scan *.md" },
{ cmd = "jsonlint src/i18n/*.json" },
{ cmd = "pylint --rcfile=.pylint/src ./src" },
{ cmd = "pylint --rcfile=.pylint/tests ./tests" },
{ cmd = "pylint --rcfile=.pylint/tests ./e2e" },
{ cmd = "pylint --rcfile=.pylint/tests ./e2e_drives" },
]
pre-commit = ["format", "lint", "test"]
# ------------------------------------------------------------
# Build tasks — all accept an optional --debug flag.
#
# Allowed values (case-sensitive, matches PyInstaller levels):
# TRACE | DEBUG | INFO | WARN | ERROR | CRITICAL
#
# Default is WARN so normal builds stay quiet.
#
# The --debug value is passed directly as a CLI argument to the
# Python build scripts to avoid poe env interpolation issues
# with sequence tasks.
#
# Usage examples:
# uv run poe build-macos
# uv run poe build-macos --debug=TRACE
# uv run poe build-linux --debug=DEBUG
# uv run poe build-win --debug=INFO
# ------------------------------------------------------------
[tool.poe.tasks.build-linux]
args = [{ name = "debug", default = "WARN", positional = false }]
sequence = [
{ cmd = "bash prebuild/fetch_firmware.sh" },
{ cmd = "sh .ci/patch-pyinstaller-kivy-hook.sh" },
{ cmd = "python .ci/create-spec.py --loglevel=${debug}" },
{ cmd = "python .ci/build.py --loglevel=${debug}" },
]
[tool.poe.tasks.build-macos]
args = [{ name = "debug", default = "WARN", positional = false }]
sequence = [
{ cmd = "bash prebuild/fetch_firmware.sh" },
{ cmd = "find . -name '.DS_Store' -delete" },
{ cmd = "sh .ci/patch-pyinstaller-kivy-hook.sh" },
{ cmd = "python .ci/create-spec.py --loglevel=${debug}" },
{ cmd = "python .ci/build.py --loglevel=${debug}" },
]
[tool.poe.tasks.build-win]
args = [{ name = "debug", default = "WARN", positional = false }]
sequence = [
{ cmd = "bash prebuild/fetch_firmware.sh" },
{ cmd = "powershell.exe -File .ci/patch-pyinstaller-kivy-hook.ps1" },
{ cmd = "python .ci/create-spec.py --loglevel=${debug}" },
{ interpreter = ["powershell", "pwsh"], shell = "& .ci/edit-spec.ps1" },
{ cmd = "python .ci/build.py --loglevel=${debug}" },
]
[tool.poe.tasks.dev-debug]
env = { LOGLEVEL = "debug" }
cmd = "python krux_installer.py"
[tool.poe.tasks.dev]
env = { LOGLEVEL = "info" }
cmd = "python krux_installer.py"
[tool.black]
target-version = ["py312"]
[tool.poe.tasks.format-license]
args = [
{ name = "check", options = ["-c", "--check"], type = "boolean", default = true },
{ name = "to_year", options = ["-t", "--to-year"], type = "integer", default = 2024 },
{ name = "replace_year", options = ["-r", "--replace-year"], type = "integer", default = 0 }
]
shell = '''
set -o pipefail
from_year=2021
check="${check:-True}"
to_year="${to_year:-2024}"
replace_year="${replace_year:-0}"
if [ "${replace_year}" -gt "${from_year}" ] && [ "${replace_year}" -gt "${to_year}" ]; then
printf 'WARNING: rewriting license year %s-%s -> %s-%s in all *.py files\n' "${from_year}" "${to_year}" "${from_year}" "${replace_year}"
find . -name "*.py" -exec sed -i.bak "s/${from_year}-${to_year} Krux contributors/${from_year}-${replace_year} Krux contributors/g" {} +
find . -name "*.py.bak" -delete
elif [ "${check}" = "True" ]; then
printf 'WARNING: scanning ./src for %s-%s Krux contributors (no files modified)\n' "${from_year}" "${to_year}"
grep -rnw './src/' -e "${from_year}-${to_year} Krux contributors" --include='*.py' || true
fi
'''