From 29c08adae171f1c273a0a15c00068205a9965bf2 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Mon, 7 Oct 2024 08:07:09 +0800 Subject: [PATCH] pythonRelaxDepsHook: lint with ShellCheck Ignore SC2164 at this moment, as it will be gone when adding `set -e`. --- .../interpreters/python/hooks/python-relax-deps-hook.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/development/interpreters/python/hooks/python-relax-deps-hook.sh b/pkgs/development/interpreters/python/hooks/python-relax-deps-hook.sh index cccb49313469..9b5bd6f37ca9 100644 --- a/pkgs/development/interpreters/python/hooks/python-relax-deps-hook.sh +++ b/pkgs/development/interpreters/python/hooks/python-relax-deps-hook.sh @@ -48,6 +48,7 @@ _pythonRelaxDeps() { sed -i "$metadata_file" -r \ -e 's/(Requires-Dist: [a-zA-Z0-9_.-]+\s*(\[[^]]+\])?)[^;]*(;.*)?/\1\3/' else + # shellcheck disable=SC2048 for dep in ${pythonRelaxDeps[*]}; do sed -i "$metadata_file" -r \ -e "s/(Requires-Dist: $dep\s*(\[[^]]+\])?)[^;]*(;.*)?/\1\3/i" @@ -64,6 +65,7 @@ _pythonRemoveDeps() { sed -i "$metadata_file" \ -e '/Requires-Dist:.*/d' else + # shellcheck disable=SC2048 for dep in ${pythonRemoveDeps[*]-}; do sed -i "$metadata_file" \ -e "/Requires-Dist: $dep/d" @@ -86,11 +88,14 @@ pythonRelaxDepsHook() { rm -rf "$wheel" # Using no quotes on purpose since we need to expand the glob from `$metadata_file` + # shellcheck disable=SC2086 _pythonRelaxDeps $metadata_file + # shellcheck disable=SC2086 _pythonRemoveDeps $metadata_file if (("${NIX_DEBUG:-0}" >= 1)); then echo "pythonRelaxDepsHook: resulting METADATA for '$wheel':" + # shellcheck disable=SC2086 cat $metadata_file fi