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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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: except OSError as e:
if e.errno == errno.EACCES: if e.errno == errno.EACCES:
try: 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) logger.warning("Missing permissions on %s\n%s.", device_info.path, output)
except Exception: except Exception:
pass pass

View File

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

View File

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

View File

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

View File

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

View File

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