summaryrefslogtreecommitdiff
path: root/wrappers/python/discovery.py
diff options
context:
space:
mode:
Diffstat (limited to 'wrappers/python/discovery.py')
-rw-r--r--wrappers/python/discovery.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/wrappers/python/discovery.py b/wrappers/python/discovery.py
index 2a9dcbe..21118a9 100644
--- a/wrappers/python/discovery.py
+++ b/wrappers/python/discovery.py
@@ -1,9 +1,13 @@
-#!/usr/bin/env python3
-
import platform
from ctypes import *
from enum import Enum
+_lib_suffixes = {
+ "windows": ".dll",
+ "linux": ".so",
+ "darwin": ".dylib",
+}
+
_arch = platform.machine().lower()
_arch = \
{
@@ -22,7 +26,7 @@ _arch = \
_os = platform.system().lower()
-_lib = cdll.LoadLibrary(f"../../exports/{_os}/{_arch}/eduvpn_verify")
+_lib = cdll.LoadLibrary(f"../../exports/{_os}/{_arch}/eduvpn_verify{_lib_suffixes[_os]}")
class GoSlice(Structure):
@@ -62,7 +66,7 @@ class VerifyError(Exception):
VerifyErrorCode.ErrUnknownExpectedFileName: "unknown expected file name",
VerifyErrorCode.ErrInvalidSignature: "invalid signature",
VerifyErrorCode.ErrInvalidSignatureUnknownKey: "invalid signature (unknown key)",
- VerifyErrorCode.ErrTooOld: "replay of previous signature (rollback)"
+ VerifyErrorCode.ErrTooOld: "replay of previous signature (rollback)",
}[self.code] if self.code != VerifyErrorCode.Unknown else f"unknown verify error ({self.code_int})"