Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conda_build.os_utils.liefldd.ensure_binary to handle None #5124

Merged
merged 2 commits into from
Dec 26, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions conda_build/os_utils/liefldd.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ def is_string(s):
# these are to be avoided, or if not avoided they
# should be passed a binary when possible as that
# will prevent having to parse it multiple times.
def ensure_binary(file: str | os.PathLike | Path | lief.Binary) -> lief.Binary | None:
def ensure_binary(
file: str | os.PathLike | Path | lief.Binary | None,
) -> lief.Binary | None:
if isinstance(file, lief.Binary):
return file
elif not Path(file).exists():
elif not file or not Path(file).exists():
return None
try:
return lief.parse(str(file))
Expand Down Expand Up @@ -525,9 +527,9 @@ def inspect_linkages_lief(
todo.pop(0)
filename2 = element[0]
binary = element[1]
uniqueness_key = get_uniqueness_key(binary)
if not binary:
continue
uniqueness_key = get_uniqueness_key(binary)
if uniqueness_key not in already_seen:
parent_exe_dirname = None
if binary.format == lief.EXE_FORMATS.PE:
Expand Down