From 98de48fc8fc8653d82ed4769209564126d299878 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Fri, 11 Aug 2023 11:39:07 +0100 Subject: pythonRelaxDepsHook: remove version from pkg_name Since the wheel file name is based on the package metadata instead of what we set in the derivation, if you set the version as `unstable-YYYYMMDD`, for example, the hook would silently fail. We will ignore the version now and just use a glob instead to match anything that has the package name in its path. Fixes #248185. --- .../interpreters/python/hooks/python-relax-deps-hook.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'pkgs/development/interpreters/python/hooks/python-relax-deps-hook.sh') 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 31bdec914f6..3502fe10636 100644 --- a/pkgs/development/interpreters/python/hooks/python-relax-deps-hook.sh +++ b/pkgs/development/interpreters/python/hooks/python-relax-deps-hook.sh @@ -78,24 +78,25 @@ pythonRelaxDepsHook() { pushd dist # See https://peps.python.org/pep-0491/#escaping-and-unicode - local -r pkg_name="${pname//[^[:alnum:].]/_}-$version" + local -r pkg_name="${pname//[^[:alnum:].]/_}" local -r unpack_dir="unpacked" - local -r metadata_file="$unpack_dir/$pkg_name/$pkg_name.dist-info/METADATA" + local -r metadata_file="$unpack_dir/$pkg_name*/$pkg_name*.dist-info/METADATA" # We generally shouldn't have multiple wheel files, but let's be safer here for wheel in "$pkg_name"*".whl"; do @pythonInterpreter@ -m wheel unpack --dest "$unpack_dir" "$wheel" rm -rf "$wheel" - _pythonRelaxDeps "$metadata_file" - _pythonRemoveDeps "$metadata_file" + # Using no quotes on purpose since we need to expand the glob from `$metadata_file` + _pythonRelaxDeps $metadata_file + _pythonRemoveDeps $metadata_file if (( "${NIX_DEBUG:-0}" >= 1 )); then echo "pythonRelaxDepsHook: resulting METADATA for '$wheel':" - cat "$unpack_dir/$pkg_name/$pkg_name.dist-info/METADATA" + cat $metadata_file fi - @pythonInterpreter@ -m wheel pack "$unpack_dir/$pkg_name" + @pythonInterpreter@ -m wheel pack "$unpack_dir/$pkg_name"* done # Remove the folder since it will otherwise be in the dist output. -- cgit 1.4.1