Skip to content

Commit 1e463c6

Browse files
committed
Update reuse_lint
1 parent 6649f44 commit 1e463c6

1 file changed

Lines changed: 35 additions & 2 deletions

File tree

bin/reuse_lint

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
1+
#!/bin/bash
12
# Copyright (c) 2025 Uwe Fechner
23
# SPDX-License-Identifier: MIT
34

4-
cd ..
5-
pipx run reuse lint
5+
set -euo pipefail
6+
7+
if [[ $(basename $(pwd)) == "bin" ]]; then
8+
cd ..
9+
fi
10+
11+
# Prefer pipx when available, but handle broken pipx launchers gracefully.
12+
if command -v pipx >/dev/null 2>&1; then
13+
if pipx run reuse --help >/dev/null 2>&1; then
14+
exec pipx run reuse lint
15+
fi
16+
fi
17+
18+
if command -v python3 >/dev/null 2>&1; then
19+
if python3 -m pipx --version >/dev/null 2>&1; then
20+
exec python3 -m pipx run reuse lint
21+
fi
22+
fi
23+
24+
if command -v reuse >/dev/null 2>&1; then
25+
exec reuse lint
26+
fi
27+
28+
if command -v python3 >/dev/null 2>&1; then
29+
if python3 -c "import reuse" >/dev/null 2>&1; then
30+
exec python3 -m reuse lint
31+
fi
32+
fi
33+
34+
echo "Could not run REUSE lint. Install one of: pipx + reuse, or python package reuse." >&2
35+
echo "Examples:" >&2
36+
echo " pipx install reuse" >&2
37+
echo " python3 -m pip install --user reuse" >&2
38+
exit 1

0 commit comments

Comments
 (0)