Skip to content

Commit

Permalink
Merge 8bd541c into eabf2e4
Browse files Browse the repository at this point in the history
  • Loading branch information
m-n-a-g committed Apr 16, 2021
2 parents eabf2e4 + 8bd541c commit ed85203
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions nixnet/_lib.py
Expand Up @@ -57,11 +57,23 @@ def _import_win_lib():
return XnetLibrary(cdll)


def _import_linux_lib():
lib_name = "libnixnet.so"
try:
cdll = ctypes.cdll.LoadLibrary(lib_name)
except OSError:
raise XnetNotFoundError()
return XnetLibrary(cdll)


def _import_unsupported():
raise PlatformUnsupportedError(sys.platform)


if sys.platform.startswith('win') or sys.platform.startswith('cli'):
import_lib = _import_win_lib
elif sys.platform.startswith('linux'):
import_lib = _import_linux_lib
else:
import_lib = _import_unsupported

0 comments on commit ed85203

Please sign in to comment.