Skip to content

Commit

Permalink
lock1: Hoist up local project assignment scope
Browse files Browse the repository at this point in the history
  • Loading branch information
adisbladis committed Sep 7, 2024
1 parent 5dbc3db commit 2e5707d
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions lib/lock1.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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 (
{
Expand Down

0 comments on commit 2e5707d

Please sign in to comment.