Skip to content

Commit

Permalink
More logging around default binary path search
Browse files Browse the repository at this point in the history
  • Loading branch information
pylakey committed Jun 19, 2024
1 parent fd94d24 commit 50dcf77
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions aiotdlib/tdjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
'freebsd': 'so',
}

logger = logging.getLogger(__name__)


def _get_bundled_tdjson_lib_path() -> str:
tdjson_path = find_library('tdjson')
Expand All @@ -42,7 +44,10 @@ def _get_bundled_tdjson_lib_path() -> str:
raise RuntimeError('Prebuilt TDLib binary is not included for this system')

binary_name = f'libtdjson_{system_name}_{machine_name}.{extension}'
return str((pathlib.Path(__file__).parent / 'tdlib' / binary_name).absolute())
bundled_lib_path = (pathlib.Path(__file__).parent / 'tdlib' / binary_name).resolve()
logger.info('Current system: %s %s', system_name, machine_name)
logger.info('Bundled TDLib binary: %s', bundled_lib_path)
return str(bundled_lib_path)


def _encode_tdjson_query(query: TDJsonQuery) -> bytes:
Expand Down Expand Up @@ -73,7 +78,7 @@ def __init__(self, library_path: str | pathlib.Path):
if not bool(library_path):
raise ValueError('Library path must be provided')

library_path = pathlib.Path(library_path)
library_path = pathlib.Path(library_path).resolve()

if not bool(library_path.exists()):
raise FileNotFoundError(f'Library path {library_path} does not exist')
Expand Down

0 comments on commit 50dcf77

Please sign in to comment.