Skip to content
Snippets Groups Projects
Commit 4487a6ef authored by AlQuemist's avatar AlQuemist
Browse files

mac_package: capture errors resulting from subprocesses

parent 8b337d58
No related branches found
No related tags found
3 merge requests!2050rebase main on r21/v21.1,!2047<root>/CMakeLists.txt: add 'BornAgain_LIBRARIES' cached variable to store...,!1988Migrate to pyenv Python Platform; Fix MacOS package (Major change)
......@@ -800,23 +800,30 @@ print("\n%s: Add proper RPATHs to the binaries..." % TITLE)
for lib in (l for l in pkg.dst_tbl.values() if l.rpaths):
# eg. RPATHS for 'lib/libA.dylib': ../Library , ../Frameworks/Qt
# eg. install_name_tool libA.so -add_rpath RPATH1 -add_rpath RPATH2 ...
_cmd_list = ["install_name_tool", lib.dst]
_cmd_list = []
for cmd in (["-add_rpath", r] for r in lib.rpaths):
_cmd_list.extend(cmd)
# execute the command
subp.check_output(_cmd_list)
if not _cmd_list: continue
_prc = subp.run(["install_name_tool", lib.dst, *_cmd_list])
if _prc.returncode != 0:
print("%s: Command failed: %s" % (TITLE, _prc.args))
# modify the library references;
# eg. '/usr/local/opt/foo.dylib' => '@rpath/foo.dylib'
print("\n%s: Change library references in binaries..." % TITLE)
for lib in (l for l in pkg.dst_tbl.values() if l.dependencies):
# eg. install_name_tool libA.so -change REF1_old REF1_new -change REF2_old REF2_new ...
_cmd_list = ["install_name_tool", lib.dst]
_cmd_list = []
for ref_old in lib.dependencies:
ref_new = pkg.ref_tbl[ref_old]
if ref_old != ref_new: _cmd_list.extend(["-change", ref_old,ref_new])
# execute the command
subp.check_output(_cmd_list)
if not _cmd_list: continue
_prc = subp.run(["install_name_tool", lib.dst, *_cmd_list])
if _prc.returncode != 0:
print("%s: Command failed: %s" % (TITLE, _prc.args))
#-- END
print("\n%s: Done.\n" % TITLE)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment