Skip to content

fixes to pyccs installation #8

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ../..
Expand Down
37 changes: 27 additions & 10 deletions pyccs/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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])]
)