osxbundle: print meaningful error when a dylib is missing

If one of the bundled libraries is pointing to a missing dylib stop the
bundling and exit with an error. This can happen if the user uninstalled a
dependency after he built the binary/libraries.
This commit is contained in:
Stefano Pigozzi 2012-12-16 10:56:25 +01:00
parent 4c95f545d3
commit 51c98619c8
1 changed files with 7 additions and 1 deletions

View File

@ -64,7 +64,13 @@ def run_install_name_tool(target_file, dylib_path, dest_dir, root=True):
def cp_dylibs(target_file, dest_dir):
for dylib_path in user_dylib_lst(target_file):
dylib_dest_path = os.path.join(dest_dir, os.path.basename(dylib_path))
shutil.copy(dylib_path, dylib_dest_path)
try:
shutil.copy(dylib_path, dylib_dest_path)
except IOError:
sys.exit("%s uses library %s which is not available anymore" % \
(target_file, dylib_path) )
os.chmod(dylib_dest_path, 0o755)
cp_dylibs(dylib_dest_path, dest_dir)