Merge pull request #176721 from thiagokokada/pythonRelaxDepsHook-fix
pythonRelaxDepsHook: fix usage in packages with `-` in pname
This commit is contained in:
commit
5f51c12a38
|
@ -59,23 +59,26 @@ _pythonRemoveDeps() {
|
|||
pythonRelaxDepsHook() {
|
||||
pushd dist
|
||||
|
||||
local -r package="$pname-$version"
|
||||
# See https://peps.python.org/pep-0491/#escaping-and-unicode
|
||||
local -r pkg_name="${pname//[^[:alnum:].]/_}-$version"
|
||||
local -r unpack_dir="unpacked"
|
||||
local -r metadata_file="$unpack_dir/$package/$package.dist-info/METADATA"
|
||||
local -r wheel=$(echo "$package"*".whl")
|
||||
local -r metadata_file="$unpack_dir/$pkg_name/$pkg_name.dist-info/METADATA"
|
||||
|
||||
@pythonInterpreter@ -m wheel unpack --dest "$unpack_dir" "$wheel"
|
||||
rm -rf "$wheel"
|
||||
# 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"
|
||||
_pythonRelaxDeps "$metadata_file"
|
||||
_pythonRemoveDeps "$metadata_file"
|
||||
|
||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||
echo "pythonRelaxDepsHook: resulting METADATA:"
|
||||
cat "$unpack_dir/$package/$package.dist-info/METADATA"
|
||||
fi
|
||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
||||
echo "pythonRelaxDepsHook: resulting METADATA for '$wheel':"
|
||||
cat "$unpack_dir/$pkg_name/$pkg_name.dist-info/METADATA"
|
||||
fi
|
||||
|
||||
@pythonInterpreter@ -m wheel pack "$unpack_dir/$package"
|
||||
@pythonInterpreter@ -m wheel pack "$unpack_dir/$pkg_name"
|
||||
done
|
||||
|
||||
popd
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
, pysigma
|
||||
, pytestCheckHook
|
||||
, pythonOlder
|
||||
, pythonRelaxDepsHook
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
|
@ -23,12 +24,17 @@ buildPythonPackage rec {
|
|||
|
||||
nativeBuildInputs = [
|
||||
poetry-core
|
||||
pythonRelaxDepsHook
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
pysigma
|
||||
];
|
||||
|
||||
pythonRelaxDeps = [
|
||||
"pysigma"
|
||||
];
|
||||
|
||||
checkInputs = [
|
||||
pytestCheckHook
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue