From 2e5707d82e246964ef73544f7a96fe008dec6d50 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Sat, 7 Sep 2024 12:13:34 +1200 Subject: [PATCH] lock1: Hoist up local project assignment scope --- lib/lock1.nix | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/lib/lock1.nix b/lib/lock1.nix index 5e46194..b03e5ba 100644 --- a/lib/lock1.nix +++ b/lib/lock1.nix @@ -292,6 +292,21 @@ fix (self: { # List of parsed wheels wheelFiles = map (whl: whl.file') package.wheels; + localProject = if projects ? package.name then + projects.${package.name} + else + pyproject-nix.lib.project.loadUVPyproject { + projectRoot = + if isProject then + workspaceRoot + "/${source.editable}" + else if isDirectory then + workspaceRoot + "/${source.directory}" + else if isVirtual then + workspaceRoot + "/${source.virtual}" + else + throw "Not a project path: ${toJSON source}"; + }; + in # Callpackage function { @@ -372,25 +387,7 @@ fix (self: { assert assertMsg (format == "wheel" -> !elem package.name no-binary-packages) "Package source for '${package.name}' was derived as wheel, but was present in tool.uv.no-binary-package"; if (isProject || isDirectory || isVirtual) then - buildPythonPackage ( - ( - if projects ? package.name then - projects.${package.name} - else - pyproject-nix.lib.project.loadUVPyproject { - projectRoot = - if isProject then - workspaceRoot + "/${source.editable}" - else if isDirectory then - workspaceRoot + "/${source.directory}" - else if isVirtual then - workspaceRoot + "/${source.virtual}" - else - throw "Not a project path: ${toJSON source}"; - } - ).renderers.buildPythonPackage - { inherit python environ; } - ) + buildPythonPackage (localProject.renderers.buildPythonPackage { inherit python environ; }) else buildPythonPackage ( {