From ff68e7aff70c10eba66cbd8996239a95bf822b55 Mon Sep 17 00:00:00 2001 From: stevenqie Date: Tue, 11 Feb 2025 17:02:55 -0600 Subject: [PATCH 1/2] bug fixes done --- pyccs/server.py | 37 +++++++++++++++++++++++++++---------- setup.py | 5 ++++- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/pyccs/server.py b/pyccs/server.py index 5b35e92..f99a6f5 100644 --- a/pyccs/server.py +++ b/pyccs/server.py @@ -41,17 +41,34 @@ def _find_library() -> str: import sys import platform - local_dir = os.path.join(sys.prefix, 'lib') this_system = platform.system().lower() - try: - if this_system == "darwin": - lib_path = os.path.join(local_dir, 'libccs-client.dylib') - else: - lib_path = os.path.join(local_dir, 'libccs-client.so') - assert os.path.exists(lib_path) - return lib_path - except: - raise + + # regular case + system_lib_dir = os.path.join(sys.prefix, 'lib') + if this_system == "darwin": + system_lib_path = os.path.join(system_lib_dir, 'libccs-client.dylib') + else: + system_lib_path = os.path.join(system_lib_dir, 'libccs-client.so') + + if os.path.exists(system_lib_path): + return system_lib_path + + # other case user base directory (~/.local/lib/) + user_lib_dir = os.path.join(os.path.expanduser("~"), '.local', 'lib') + if this_system == "darwin": + user_lib_path = os.path.join(user_lib_dir, 'libccs-client.dylib') + else: + user_lib_path = os.path.join(user_lib_dir, 'libccs-client.so') + + if os.path.exists(user_lib_path): + return user_lib_path + + raise FileNotFoundError( + f"Library not found. Checked locations:\n" + f" 1. {system_lib_path}\n" + f" 2. {user_lib_path}\n" + f"Ensure libccs-client.so is installed in one of these locations." + ) @dataclass class ConnectionInfo: diff --git a/setup.py b/setup.py index 13c5513..1d9d2ff 100644 --- a/setup.py +++ b/setup.py @@ -12,16 +12,19 @@ def get_build_os(): return os.lower() system = get_build_os() +libccs_client = None if system == "darwin": try: assert os.path.exists('charm_src/charm/lib_so/libccs-client.dylib') + libccs_client = 'charm_src/charm/lib_so/libccs-client.dylib' except AssertionError: print("ERROR: Library file 'charm_src/charm/lib_so/libccs-client.dylib' not found!") raise else: try: assert os.path.exists('charm_src/charm/lib_so/libccs-client.so') + libccs_client = 'charm_src/charm/lib_so/libccs-client.so' except AssertionError: print("ERROR: Library file 'charm_src/charm/lib_so/libccs-client.so' not found!") raise @@ -50,5 +53,5 @@ def get_build_os(): 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', ], - data_files=[('lib', ['charm_src/charm/lib_so/libccs-client.dylib'])] + data_files=[('lib', [libccs_client])] ) From 82c86e03f07407ca10de30bc72d8fca42fa4010c Mon Sep 17 00:00:00 2001 From: stevenqie Date: Tue, 11 Feb 2025 17:24:45 -0600 Subject: [PATCH 2/2] modify readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f1bb754..6658b13 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ Moreover, Charm++ must be built in the following manner for compatibility with P Complete installation commands follow: ```bash -git clone git@github.com:UIUC-PPL/PyCCS.git +git clone https://github.com/UIUC-PPL/pyccs cd PyCCS -git clone git@github.com:UIUC-PPL/charm.git charm_src/charm +git clone https://github.com/UIUC-PPL/charm charm_src/charm cd charm_src/charm ./buildold converse netlrts-linux-x86_64 --with-production -j3 --force --build-shared cd ../..