INNER CODE UNIT · Python
is_running_under_pyinstaller
pairinteraction/pairinteraction · src/pairinteraction/__init__.py:35
def is_running_under_pyinstaller() -> bool:
return getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS")
def find_library_file_in_package(substring: str, package: str) -> Path | None:
"""Find the library file if it got installed together with the package."""
if (package_files := files(package)) is not None:
for p in package_files:
if substring in p.stem:
return Path(p.locate()).resolve()
return None
def find_library_file_in_directory(substring: str, directory: Path = Path(__file__).parent) -> Path | None:
"""Find the library file if it is in the specified directory."""
for p in directory.glob("*"):
if substring in p.stem:
return p.resolve()
return None