Skip to content

Commit

Permalink
sbomnix/meta.py: Allow None in nixpkgs path
Browse files Browse the repository at this point in the history
Gracefully handle the case where the call to nixref_to_nixpkgs_path
returns None

Signed-off-by: Henri Rosten <[email protected]>
  • Loading branch information
henrirosten committed Aug 2, 2024
1 parent d35e16c commit 739168a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sbomnix/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ def get_nixpkgs_meta(self, nixref=None):
if nixref:
# Read meta from nixpkgs pinned by nixref
LOG.debug("Reading nixpkgs path from nixref: %s", nixref)
nixpkgs_path = nixref_to_nixpkgs_path(nixref).as_posix()
nixpath = nixref_to_nixpkgs_path(nixref)
if nixpath:
nixpkgs_path = nixpath.as_posix()
elif "NIX_PATH" in os.environ:
# Read meta from nipxkgs referenced in NIX_PATH
LOG.debug("Reading nixpkgs path from NIX_PATH environment")
Expand Down

0 comments on commit 739168a

Please sign in to comment.