misc: Use PATH instead of hardcoded absolute paths (#3014)

for better shebang and multi platform support
This commit is contained in:
Ruffin
2025-11-03 12:28:10 -06:00
committed by GitHub
parent cff0110f81
commit ec5b406909
6 changed files with 17 additions and 17 deletions

View File

@@ -342,7 +342,7 @@ def _process_add(device_info: DeviceInfo, retry):
except OSError as e:
if e.errno == errno.EACCES:
try:
output = subprocess.check_output(["/usr/bin/getfacl", "-p", device_info.path], text=True)
output = subprocess.check_output(["getfacl", "-p", device_info.path], text=True)
logger.warning("Missing permissions on %s\n%s.", device_info.path, output)
except Exception:
pass

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
repo=pwr-Solaar/Solaar

View File

@@ -1,9 +1,9 @@
#!/bin/sh
#!/usr/bin/env sh
cd "$(dirname "$0")/.."
find . -type f -name '*.py[co]' -delete
find . -type d -name '__pycache__' -delete
/bin/rm --force po/*~
/bin/rm --force --recursive share/locale/
rm --force po/*~
rm --force --recursive share/locale/

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -e
@@ -9,8 +9,8 @@ while read po_file; do
language="$(basename "$po_file")"
language="${language%.po}"
target="$PWD/share/locale/$language/LC_MESSAGES/solaar.mo"
/bin/mkdir --parents "$(dirname "$target")"
/usr/bin/msgfmt \
mkdir --parents "$(dirname "$target")"
msgfmt \
--check \
--output-file="$target" \
"$po_file"

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
set -e
@@ -13,7 +13,7 @@ cd "$(readlink -f "$(dirname "$0")/..")"
VERSION=$(python setup.py --version)
DOMAIN=$(python setup.py --name)
SOURCE_FILES=$(/bin/mktemp --tmpdir $DOMAIN-po-update-XXXXXX)
SOURCE_FILES=$(mktemp --tmpdir $DOMAIN-po-update-XXXXXX)
find "lib" -name '*.py' >"$SOURCE_FILES"
POT_DIR="$PWD/po"
@@ -21,7 +21,7 @@ test -d "$POT_DIR"
POT_FILE="$POT_DIR/$DOMAIN.pot"
/usr/bin/xgettext \
xgettext \
--package-name "$DOMAIN" \
--package-version "$VERSION" \
--default-domain="$L_NAME" \
@@ -30,7 +30,7 @@ POT_FILE="$POT_DIR/$DOMAIN.pot"
--add-comments=I18N \
--output="$POT_FILE"
/bin/sed --in-place --expression="s/charset=CHARSET/charset=UTF-8/" "$POT_FILE"
sed --in-place --expression="s/charset=CHARSET/charset=UTF-8/" "$POT_FILE"
unfmt() {
@@ -39,7 +39,7 @@ unfmt() {
SOURCE="/usr/share/locale-langpack/$LL_CC/LC_MESSAGES/$1.mo"
fi
local TARGET="$(mktemp --tmpdir $1-$LL_CC-XXXXXX.po)"
/usr/bin/msgunfmt \
msgunfmt \
--no-escape --indent \
--output-file="$TARGET" \
"$SOURCE"
@@ -50,12 +50,12 @@ update_po() {
local LL_CC="$1"
local PO_FILE="$POT_DIR/$LL_CC.po"
test -r "$PO_FILE" || /usr/bin/msginit \
test -r "$PO_FILE" || msginit \
--no-translator --locale="$LL_CC" \
--input="$POT_FILE" \
--output-file="$PO_FILE"
/usr/bin/msgmerge \
msgmerge \
--update --no-fuzzy-matching \
--no-escape --indent --add-location --sort-by-file \
--lang="$LL_CC" \
@@ -63,7 +63,7 @@ update_po() {
--compendium="$(unfmt gtk30-properties)" \
"$PO_FILE" "$POT_FILE"
# /bin/sed --in-place --expression="s/Language: \\\\n/Language: $L_NAME\\\\n/" "$PO_FILE"
# sed --in-place --expression="s/Language: \\\\n/Language: $L_NAME\\\\n/" "$PO_FILE"
echo "Updated $PO_FILE"
}

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env sh
if test -z "$1"; then
echo "Use: $0 <device number 1..6> [<receiver device>]"