diff --git a/cmake/scripts/fix_apple_bundle.py b/cmake/scripts/fix_apple_bundle.py index 0f2233e4f93f1e1a5496cce0521c227a9047ce5a..dd38ffecbbc463c4a472e9702cab425c9c8b367f 100644 --- a/cmake/scripts/fix_apple_bundle.py +++ b/cmake/scripts/fix_apple_bundle.py @@ -51,7 +51,7 @@ def qtplugins_path(): def bornagain_binaries(): - result = glob.glob(os.path.join(bundle_dir(), "Contents","lib","BornAgain-*","*")) + result = glob.glob(os.path.join(bundle_dir(), "Contents", "lib", "BornAgain-*", "*")) result.append(bundle_main_executable()) return result diff --git a/dev-tools/python-setup/bornagain_python_install.py b/dev-tools/python-setup/bornagain_python_install.py index f9f13ae708dc9459c8f90b6c3e327521aa964efb..25bea698bb30f7f7e1acd85ced623f8eebbfb714 100644 --- a/dev-tools/python-setup/bornagain_python_install.py +++ b/dev-tools/python-setup/bornagain_python_install.py @@ -122,7 +122,7 @@ from setuptools import setup datadir = os.path.join('bornagain', 'lib','BornAgain-{0}') datafiles = [(datadir, [f for f in glob.glob(os.path.join(datadir, '*'))])] -datadir = os.path.join('bornagain', 'lib','ThirdParty') +datadir = os.path.join('bornagain', 'lib','Frameworks') datafiles += [(datadir, [f for f in glob.glob(os.path.join(datadir, '*'))])] setup(name='bornagain', @@ -179,12 +179,11 @@ def copy_libraries(app_dir, destination_dir): Copy libraries from BornAgain.app into corresponding BornAgain Python package directory """ print "--> Copying libraries from '{0}'".format(app_dir) - source_dir = os.path.join(app_dir, "Contents", "lib") - app_bornagainlib_dir = os.path.join(source_dir, "BornAgain-"+BORNAGAIN_VERSION) - app_thirdpartylib_dir = os.path.join(source_dir, "ThirdParty") - + app_bornagainlib_dir = os.path.join(app_dir, "Contents", "lib", "BornAgain-"+BORNAGAIN_VERSION) + app_frameworks_dir = os.path.join(app_dir, "Contents", "Frameworks") + + # copying BornAgain libraries shutil.copytree(app_bornagainlib_dir, os.path.join(destination_dir, "BornAgain-"+BORNAGAIN_VERSION)) - shutil.copytree(app_thirdpartylib_dir, os.path.join(destination_dir, "ThirdParty")) # cleaning unnecessary files libfiles = glob.glob(os.path.join(destination_dir, '*/libBornAgainGUI*')) @@ -192,17 +191,30 @@ def copy_libraries(app_dir, destination_dir): os.remove(f) pass + # copying libraries from Frameworks + frameworks_libs = glob.glob(os.path.join(app_frameworks_dir, 'lib*')) + frameworks_dest = os.path.join(destination_dir, "Frameworks") + if not os.path.exists(frameworks_dest): + os.makedirs(frameworks_dest) + for lib in frameworks_libs: + shutil.copyfile(lib, os.path.join(frameworks_dest, os.path.basename(lib))) + def patch_libraries(dir_name): """ Patches libraries depending on Python to point on the same shared libpython2.7.dylib which current interpreter is using """ print "--> Patching libraries to rely on '{0}'".format(get_python_shared_library()) - #libfiles = [(dir_name, [f for f in glob.glob(os.path.join(dir_name, '*/libBornAgainCore*'))])] libfiles = glob.glob(os.path.join(dir_name, '*/libBornAgain*')) + for f in libfiles: + cmd = "install_name_tool -delete_rpath @loader_path/../../Frameworks " + f + cmd = "install_name_tool -add_rpath @loader_path/../Frameworks " + f + run_command(cmd) + libfiles += glob.glob(os.path.join(dir_name, '*/libboost_python*')) for f in libfiles: - cmd = "install_name_tool -change @rpath/libpython2.7.dylib " + get_python_shared_library() + " " + f + # cmd = "install_name_tool -change @rpath/libpython2.7.dylib " + get_python_shared_library() + " " + f + cmd = "install_name_tool -change @rpath/Python.framework/Versions/2.7/Python " + get_python_shared_library() + " " + f run_command(cmd) pass