From 5cddf6b80a39994d2d6fcac84aff086884acc262 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Mon, 18 Jul 2022 18:56:19 -0400 Subject: [PATCH 1/2] fix for all platforms --- beta/setup_libroadrunner.py | 66 ++++++++++++++----------------------- 1 file changed, 25 insertions(+), 41 deletions(-) diff --git a/beta/setup_libroadrunner.py b/beta/setup_libroadrunner.py index e91bb3cd2..4f2b37081 100644 --- a/beta/setup_libroadrunner.py +++ b/beta/setup_libroadrunner.py @@ -11,23 +11,6 @@ import tarfile import zipfile -def reminder_dynamic_link_path_macos(): - print("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") - print("* NOTE: if you have not yet done this, you need to specify where the shared libs can be found, e.g., via bash shell:") - print('export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:./addons/libRoadrunner/roadrunner/lib') - - print("\n* To make this permanent, add this line to the bottom of the respective shell startup file, e.g., .bashrc, .bash_profile, or .zshenv in your home directory.") - print("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") - -def reminder_dynamic_link_path_linux(): - print("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") - print("* NOTE: if you have not yet done this, you need to specify where the shared libs can be found, e.g., via bash shell:") - print('export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./addons/libRoadrunner/roadrunner/lib') - - print("\n* To make this permanent, add this line to the bottom of the respective shell startup file, e.g., .bashrc, .bash_profile, or .zshenv in your home directory.") - print("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") - -# print("--------- print reminder!!!!!!!!!!!!!!\n\n") if os.path.exists(os.path.join(os.path.dirname(os.path.dirname(__file__)), "addons", "libRoadrunner", "roadrunner")): print('\nlibroadrunner already installed.\n') @@ -40,8 +23,8 @@ def reminder_dynamic_link_path_linux(): rr_file = "" url = "" + mac_silicon = False if os_type.lower() == 'darwin': - reminder_dynamic_link_path_macos() if "ARM64" in platform.uname().version: # pass # reminder_dynamic_link_path() @@ -49,29 +32,26 @@ def reminder_dynamic_link_path_linux(): # url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/libs/macos12_arm64/libroadrunner_c_api.dylib" rr_file = "roadrunner_macos_arm64.tar.gz" url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/roadrunner_macos_arm64.tar.gz" + mac_silicon = True else: rr_file = "roadrunner-osx-10.9-cp36m.tar.gz" url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.4.18/" + rr_file + "/download" - # url = "https://raw.github.com/PhysiCell-Tools/intracellular_libs/blob/main/ode/libs/macos/roadrunner-osx-10.9-cp36m.tar.gz" - - # rr_file = "roadrunner-osx-10.9-cp36m.tar.gz" - # url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/libs/macos/roadrunner-osx-10.9-cp36m.tar.gz" elif os_type.lower().startswith("win"): rr_file = "roadrunner-win64-vs14-cp35m.zip" url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.4.18/" + rr_file + "/download" elif os_type.lower().startswith("linux"): - reminder_dynamic_link_path_linux() rr_file = "cpplibroadrunner-1.3.0-linux_x86_64.tar.gz" url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.3/" + rr_file + "/download" else: print("Your operating system seems to be unsupported. Please submit a ticket at https://sourceforge.net/p/physicell/tickets/ ") sys.exit(1) - # print("-------- past if block...") - # reminder_dynamic_link_path() - # fname = url.split('/')[-2] - fname = url.split('/')[-1] - print("fname = ",fname) + print("url=",url) + if mac_silicon: + fname = url.split('/')[-1] + else: + fname = url.split('/')[-2] + print("fname=",fname) # home = os.path.expanduser("~") print('libRoadRunner will now be installed into this location:') @@ -115,8 +95,13 @@ def reminder_dynamic_link_path_linux(): if os_type.lower().startswith("win"): rrlib_dir = my_file[:-4] else: # darwin or linux - rrlib_dir = my_file[:-7] - rrlib_dir = my_file[:-6] + if mac_silicon: + # idx_end = my_file.rindex('/') + # rrlib_dir = my_file[:idx_end] + rrlib_dir = my_file[:-7] + # rrlib_dir = my_file + else: + rrlib_dir = my_file[:-7] print('rrlib_dir = ',rrlib_dir) def download_cb(blocknum, blocksize, totalsize): @@ -133,12 +118,10 @@ def download_cb(blocknum, blocksize, totalsize): urllib.request.urlretrieve(url, my_file, download_cb) - # sys.exit(-1) - new_dir_name = "roadrunner" os.chdir(dir_name) print('installing (uncompressing) the file...') - if os_type.lower().startswith("win"): # on Windows + if os_type.lower().startswith("win"): try: with zipfile.ZipFile(rr_file) as zf: zf.extractall('.') @@ -148,23 +131,24 @@ def download_cb(blocknum, blocksize, totalsize): exit(1) else: # Darwin or Linux try: - print("-- attempt to extract from the tar file...", rr_file) + print("untarring ",rr_file) tar = tarfile.open(rr_file) tar.extractall() tar.close() if 'darwin' in os_type.lower(): - if "ARM64" in platform.uname().version: # on the new Mac M1, arm64 processor - # if False: - # print("--- TODO: rename ARM64 lib dir") - # sys.exit(-1) - pass # it already uncompresses and creates the 'roadrunner' dir + if mac_silicon: + os.rename("roadrunner_macos_arm64", new_dir_name) else: os.rename("roadrunner-osx-10.9-cp36m", new_dir_name) else: os.rename("libroadrunner", new_dir_name) except: - print('error untarring the file') - exit(1) + if mac_silicon: + print() + # pass + else: + print('error untarring the file') + exit(1) print('Done.\n') From 30d7f30eaadf5094d68f210ba6a25733d76b6eab Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Mon, 18 Jul 2022 19:06:55 -0400 Subject: [PATCH 2/2] reminder for dynamic libs path --- beta/setup_libroadrunner.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/beta/setup_libroadrunner.py b/beta/setup_libroadrunner.py index 4f2b37081..4f3156b8b 100644 --- a/beta/setup_libroadrunner.py +++ b/beta/setup_libroadrunner.py @@ -11,6 +11,22 @@ import tarfile import zipfile +def reminder_dynamic_link_path_macos(): + print("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") + print("* NOTE: if you have not yet done this, you need to specify where the shared libs can be found, e.g., via bash shell:") + print('export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:./addons/libRoadrunner/roadrunner/lib') + + print("\n* To make this permanent, add this line to the bottom of the respective shell startup file, e.g., .bashrc, .bash_profile, or .zshenv in your home directory.") + print("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") + +def reminder_dynamic_link_path_linux(): + print("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") + print("* NOTE: if you have not yet done this, you need to specify where the shared libs can be found, e.g., via bash shell:") + print('export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./addons/libRoadrunner/roadrunner/lib') + + print("\n* To make this permanent, add this line to the bottom of the respective shell startup file, e.g., .bashrc, .bash_profile, or .zshenv in your home directory.") + print("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n") + if os.path.exists(os.path.join(os.path.dirname(os.path.dirname(__file__)), "addons", "libRoadrunner", "roadrunner")): print('\nlibroadrunner already installed.\n') @@ -25,9 +41,9 @@ mac_silicon = False if os_type.lower() == 'darwin': + reminder_dynamic_link_path_macos() if "ARM64" in platform.uname().version: # pass - # reminder_dynamic_link_path() # print('... for the arm64 processor.') # url = "https://github.com/PhysiCell-Tools/intracellular_libs/raw/main/ode/libs/macos12_arm64/libroadrunner_c_api.dylib" rr_file = "roadrunner_macos_arm64.tar.gz" @@ -40,6 +56,7 @@ rr_file = "roadrunner-win64-vs14-cp35m.zip" url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.4.18/" + rr_file + "/download" elif os_type.lower().startswith("linux"): + reminder_dynamic_link_path_linux() rr_file = "cpplibroadrunner-1.3.0-linux_x86_64.tar.gz" url = "https://sourceforge.net/projects/libroadrunner/files/libroadrunner-1.3/" + rr_file + "/download" else: