-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathrun
executable file
·74 lines (52 loc) · 2.08 KB
/
run
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
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2024 geisserml <geisserml@gmail.com>
# SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause
# FIXME can we support running multiple commands at once ?
# FIXME auto-completion
args="${@:2}"
function check() {
autoflake src/ setupsrc/ tests/ tests_old/ setup.py docs/source/conf.py --recursive --remove-all-unused-imports --ignore-pass-statements --ignore-init-module-imports
codespell --skip="./docs/build,./tests/resources,./tests/output,./tests_old/output,./data,./sourcebuild,./dist,./.git,__pycache__,.mypy_cache,.hypothesis" -L "tabe,splitted,fith,flate"
reuse lint
}
function clean() {
rm -rf pypdfium2*.egg-info/ src/pypdfium2*.egg-info/ build/ dist/ data/* tests/output/* tests_old/output/* conda/bundle/out/ conda/helpers/out/ conda/raw/out/
}
function packaging_pypi() {
clean
check
# calling update_pdfium is not strictly necessary, but may improve performance because downloads are done in parallel, rather than linear with each package
python3 setupsrc/pypdfium2_setup/update_pdfium.py
python3 setupsrc/pypdfium2_setup/craft_packages.py pypi
twine check dist/*
# ignore W002: erroneous detection of __init__.py files as duplicates
check-wheel-contents dist/*.whl --ignore W002 --toplevel "pypdfium2,pypdfium2_raw"
}
set -x
case $1 in
test)
python3 -m pytest tests/ tests_old/ $args;;
coverage)
python3 -m coverage run --omit "tests/*,tests_old/*,src/pypdfium2_raw/bindings.py,setupsrc/*" -m pytest tests/ tests_old/ $args
python3 -m coverage report;;
docs-build)
python3 -m sphinx -b html docs/source docs/build/html $args;;
docs-open)
xdg-open docs/build/html/index.html $args &>/dev/null;;
check)
check;;
clean)
clean;;
packaging_pypi)
packaging_pypi;;
update)
python3 setupsrc/pypdfium2_setup/update_pdfium.py $args;;
craft)
python3 setupsrc/pypdfium2_setup/craft_packages.py $args;;
build)
python3 setupsrc/pypdfium2_setup/build_pdfium.py $args;;
emplace)
python3 setupsrc/pypdfium2_setup/emplace.py $args;;
*)
echo Unknown command: $1;;
esac