python3Packages.uv: account for new binary lookup methods

uv's Python module now searches for the binary in more multiple places.
Should the user have installed a separate version of the binary, then the Python module
can consider those first, then fallback to nixpkgs' uv

Changed files
+4 -3
pkgs
development
python-modules
+4 -3
pkgs/development/python-modules/uv/default.nix
···
build-system = [ hatchling ];
postPatch =
-
# Do not rely on path lookup at runtime to find the uv binary.
-
# Use the propagated binary instead.
''
substituteInPlace python/uv/_find_uv.py \
-
--replace-fail '"""Return the uv binary path."""' "return '${lib.getExe uv}'"
''
# Sidestep the maturin build system in favour of reusing the binary already built by nixpkgs,
# to avoid rebuilding the uv binary for every active python package set.
···
build-system = [ hatchling ];
postPatch =
+
# Add the path to the uv binary as a fallback after other path search methods have been exhausted
''
substituteInPlace python/uv/_find_uv.py \
+
--replace-fail \
+
'sysconfig.get_path("scripts", scheme=_user_scheme()),' \
+
'sysconfig.get_path("scripts", scheme=_user_scheme()), "${builtins.baseNameOf (lib.getExe uv)}",'
''
# Sidestep the maturin build system in favour of reusing the binary already built by nixpkgs,
# to avoid rebuilding the uv binary for every active python package set.