summaryrefslogtreecommitdiff
path: root/wrappers/python
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2023-04-12 22:48:02 +0200
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2023-09-25 09:43:37 +0200
commite361ec863961982e01f3d7f5842245dac88a05fd (patch)
treece5a92cc598d62c9a3c950d5c7bc742405943f64 /wrappers/python
parent1e54063813efb6e822df36ad39d7f889a7f2e38b (diff)
Format: Run gofumpt (Go) + black (py)
Diffstat (limited to 'wrappers/python')
-rw-r--r--wrappers/python/docs/source/conf.py9
-rw-r--r--wrappers/python/eduvpn_common/types.py20
-rwxr-xr-xwrappers/python/setup.py16
-rw-r--r--wrappers/python/tests.py2
4 files changed, 30 insertions, 17 deletions
diff --git a/wrappers/python/docs/source/conf.py b/wrappers/python/docs/source/conf.py
index 52cf3b3..57638c5 100644
--- a/wrappers/python/docs/source/conf.py
+++ b/wrappers/python/docs/source/conf.py
@@ -16,17 +16,16 @@ release = '1.1.2'
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = [
- 'sphinx.ext.autodoc',
- 'sphinx_rtd_theme',
+ "sphinx.ext.autodoc",
+ "sphinx_rtd_theme",
]
-templates_path = ['_templates']
+templates_path = ["_templates"]
exclude_patterns = []
-
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
-html_theme = 'sphinx_rtd_theme'
+html_theme = "sphinx_rtd_theme"
html_static_path = []
diff --git a/wrappers/python/eduvpn_common/types.py b/wrappers/python/eduvpn_common/types.py
index b01455d..1eba468 100644
--- a/wrappers/python/eduvpn_common/types.py
+++ b/wrappers/python/eduvpn_common/types.py
@@ -1,5 +1,13 @@
-from ctypes import (CDLL, CFUNCTYPE, Structure, c_char_p, c_int, c_ulonglong,
- c_void_p, cast)
+from ctypes import (
+ CDLL,
+ CFUNCTYPE,
+ Structure,
+ c_char_p,
+ c_int,
+ c_ulonglong,
+ c_void_p,
+ cast,
+)
from typing import Any, Iterator, List, Tuple
@@ -86,9 +94,7 @@ def get_ptr_string(lib: CDLL, ptr: c_void_p) -> str:
return ""
-def get_data_error(
- lib: CDLL, data_error: DataError
-) -> Tuple[str, str]:
+def get_data_error(lib: CDLL, data_error: DataError) -> Tuple[str, str]:
"""Convert a C data+error structure to a Python usable data+error structure
:param lib: CDLL: The Go shared library
@@ -104,9 +110,7 @@ def get_data_error(
return data, error
-def get_bool_error(
- lib: CDLL, bool_error: BoolError
-) -> Tuple[bool, str]:
+def get_bool_error(lib: CDLL, bool_error: BoolError) -> Tuple[bool, str]:
"""Convert a C boolean (c int)+error structure to a Python usable boolean+error structure
:param lib: CDLL: The Go shared library
diff --git a/wrappers/python/setup.py b/wrappers/python/setup.py
index 1bc565a..8637032 100755
--- a/wrappers/python/setup.py
+++ b/wrappers/python/setup.py
@@ -12,6 +12,7 @@ from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
_libname = "eduvpn_common"
__version__ = "1.1.2"
+
def getlibpath(plat_name: str) -> typing.Union[str, None]:
"""Get library path for plat_name relative to exports/lib/ folder."""
@@ -65,8 +66,15 @@ def getlibpath(plat_name: str) -> typing.Union[str, None]:
processed_os = os_map[plat_os]
return (
- processed_os + "/" + arch_map[plat_arch] + "/" +
- lib_prefixes[processed_os] + _libname + "-" + __version__ + lib_suffixes[processed_os]
+ processed_os
+ + "/"
+ + arch_map[plat_arch]
+ + "/"
+ + lib_prefixes[processed_os]
+ + _libname
+ + "-"
+ + __version__
+ + lib_suffixes[processed_os]
)
@@ -91,7 +99,7 @@ class bdist_wheel(_bdist_wheel):
print("Unknown platform:", self.plat_name)
sys.exit(1)
- print("Building wheel for platform:",self.plat_name)
+ print("Building wheel for platform:", self.plat_name)
# setuptools will only use paths inside the package for package_data, so we copy the library
p = "eduvpn_common/lib"
@@ -100,7 +108,7 @@ class bdist_wheel(_bdist_wheel):
os.makedirs(p)
shutil.copyfile(self.exports_lib_path + "/" + libpath, p+"/"+libpath.split("/")[-1])
_bdist_wheel.run(self)
- shutil.rmtree("eduvpn_common/lib/")
+ shutil.rmtree(p)
setup(
diff --git a/wrappers/python/tests.py b/wrappers/python/tests.py
index f2b01bd..5b36dfe 100644
--- a/wrappers/python/tests.py
+++ b/wrappers/python/tests.py
@@ -12,11 +12,13 @@ sys.path.append(
from selenium_eduvpn import login_eduvpn
+
def handler(_old_state, new_state, data):
if new_state == 6:
login_eduvpn(data)
return True
+
class ConfigTests(unittest.TestCase):
def testConfig(self):
_eduvpn = eduvpn.EduVPN("org.letsconnect-vpn.app.linux", "0.1.0", "testconfigs")