Skip to content

Commit

Permalink
lib: Stop using hasAttrByPath, use ? operator
Browse files Browse the repository at this point in the history
  • Loading branch information
adisbladis committed Aug 18, 2024
1 parent fd6d00f commit 0c81cc6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/renderers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 0c81cc6

Please sign in to comment.