Skip to content

Commit

Permalink
Allow LIEF to fail when using patchelf (#5176)
Browse files Browse the repository at this point in the history
Avoid unconditional failure when LIEF raises, even when not used.

---------

Co-authored-by: Bianca Henderson <[email protected]>
  • Loading branch information
minrk and beeankha authored Jul 16, 2024
1 parent 8c40e9b commit 1d771ad
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
16 changes: 15 additions & 1 deletion conda_build/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import shutil
import stat
import sys
import traceback
from collections import OrderedDict, defaultdict
from copy import copy
from fnmatch import filter as fnmatch_filter
Expand Down Expand Up @@ -609,7 +610,20 @@ def mk_relative_linux(f, prefix, rpaths=("lib",), method=None):
existing_pe = existing_pe.split(os.pathsep)
existing = existing_pe
if have_lief:
existing2, _, _ = get_rpaths_raw(elf)
existing2 = None
try:
existing2, _, _ = get_rpaths_raw(elf)
except Exception as e:
if method == "LIEF":
print(
f"ERROR :: get_rpaths_raw({elf!r}) with LIEF failed: {e}, but LIEF was specified"
)
traceback.print_tb(e.__traceback__)
else:
print(
f"WARNING :: get_rpaths_raw({elf!r}) with LIEF failed: {e}, will proceed with patchelf"
)
method = "patchelf"
if existing_pe and existing_pe != existing2:
print(
f"WARNING :: get_rpaths_raw()={existing2} and patchelf={existing_pe} disagree for {elf} :: "
Expand Down
3 changes: 3 additions & 0 deletions news/5176-lief-fail
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Bug fixes

* Error handling when `LIEF` fails is now consistent with `patchelf`. (#5176)

0 comments on commit 1d771ad

Please sign in to comment.