Skip to content

Commit

Permalink
renderers: Pass through unknown licenses verbatim
Browse files Browse the repository at this point in the history
Closes #62
  • Loading branch information
adisbladis committed Mar 6, 2024
1 parent 5ece746 commit 5033794
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/renderers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ in
# "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.
# These keys are mutually exclusive, so a tool MUST raise an error if the metadata specifies both keys."
# Hence the assert above.
license = licensesBySpdxId.${project'.license.text};
license = licensesBySpdxId.${project'.license.text} or project'.license.text;
}
) //
# Only set mainProgram if we only have one script, otherwise it's ambigious which one is main
Expand Down
14 changes: 14 additions & 0 deletions lib/test_renderers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ in
};
};

# Test that a license not in the spdix table is properly passed through verbatim
testNonSpdxLicense =
let
fixture = lib.recursiveUpdate fixtures."pdm.toml" { project.license.text = "Proprietary"; };
attrs = renderers.buildPythonPackage {
project = loadPyproject { pyproject = fixture; };
python = mocks.cpythonLinux38;
};
in
{
expr = attrs.meta.license;
expected = "Proprietary";
};

testPdmWithMaps = {
expr = clearDrvInputs (renderers.buildPythonPackage {
project = projects.pdm;
Expand Down

0 comments on commit 5033794

Please sign in to comment.