From 0c81cc61f3919104e318c0b91d34a29f5405d7b4 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Sun, 18 Aug 2024 22:42:43 +1200 Subject: [PATCH] lib: Stop using hasAttrByPath, use ? operator --- lib/project.nix | 4 ++-- lib/renderers.nix | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/project.nix b/lib/project.nix index 752198e..819e6a2 100644 --- a/lib/project.nix +++ b/lib/project.nix @@ -169,8 +169,8 @@ lib.fix (self: { projectRoot ? null }: let - isPoetry = lib.hasAttrByPath [ "tool" "poetry" ] pyproject; - isPep621 = lib.hasAttrByPath [ "project" ] pyproject; + isPoetry = pyproject ? tool.poetry; + isPep621 = pyproject ? project; in (if isPoetry then self.loadPoetryPyproject else if isPep621 then self.loadPyproject else throw "Project is neither Poetry nor PEP-621") { inherit pyproject projectRoot; diff --git a/lib/renderers.nix b/lib/renderers.nix index bf6dd64..df26bc4 100644 --- a/lib/renderers.nix +++ b/lib/renderers.nix @@ -119,7 +119,7 @@ in inherit (project') description; } // # Optional license - optionalAttrs (lib.hasAttrByPath [ "license" "text" ] project') ( + optionalAttrs (project' ? license.text) ( assert !(project'.license ? file); { # From PEP-621: # "The text key has a string value which is the license of the project whose meaning is that of the License field from the core metadata.