diff options
Diffstat (limited to 'wrappers/python')
| -rw-r--r-- | wrappers/python/docs/source/conf.py | 17 | ||||
| -rw-r--r-- | wrappers/python/eduvpn_common/event.py | 1 | ||||
| -rw-r--r-- | wrappers/python/eduvpn_common/main.py | 4 | ||||
| -rw-r--r-- | wrappers/python/eduvpn_common/server.py | 12 | ||||
| -rw-r--r-- | wrappers/python/example/main.py | 4 | ||||
| -rwxr-xr-x | wrappers/python/setup.py | 18 | ||||
| -rw-r--r-- | wrappers/python/tests.py | 8 |
7 files changed, 41 insertions, 23 deletions
diff --git a/wrappers/python/docs/source/conf.py b/wrappers/python/docs/source/conf.py index 52cf3b3..1a2ab32 100644 --- a/wrappers/python/docs/source/conf.py +++ b/wrappers/python/docs/source/conf.py @@ -7,26 +7,25 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information import sphinx_rtd_theme -project = 'python-eduvpn-common' -copyright = '2023, Jeroen Wijenbergh' -author = 'Jeroen Wijenbergh' -release = '1.1.2' +project = "python-eduvpn-common" +copyright = "2023, Jeroen Wijenbergh" +author = "Jeroen Wijenbergh" +release = "1.1.2" # -- General configuration --------------------------------------------------- # 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/event.py b/wrappers/python/eduvpn_common/event.py index 746a0c9..d18dd40 100644 --- a/wrappers/python/eduvpn_common/event.py +++ b/wrappers/python/eduvpn_common/event.py @@ -13,6 +13,7 @@ from eduvpn_common.types import get_ptr_string # The attribute that callback functions get EDUVPN_CALLBACK_PROPERTY = "_eduvpn_property_callback" + # A state transition decorator for classes # To use this, make sure to register the class with `register_class_callbacks` def class_state_transition(state: int, state_type: StateType) -> Callable: diff --git a/wrappers/python/eduvpn_common/main.py b/wrappers/python/eduvpn_common/main.py index 74ff52d..0bf4d07 100644 --- a/wrappers/python/eduvpn_common/main.py +++ b/wrappers/python/eduvpn_common/main.py @@ -610,9 +610,7 @@ def token_callback(name: bytes, srv, tok): obj = eduvpn_objects[name_decoded] srv_conv = get_transition_server(obj.lib, srv) tok_conv = get_tokens(obj.lib, tok) - obj.token_callback( - srv_conv, tok_conv - ) + obj.token_callback(srv_conv, tok_conv) @VPNStateChange diff --git a/wrappers/python/eduvpn_common/server.py b/wrappers/python/eduvpn_common/server.py index 1ed0752..6760b40 100644 --- a/wrappers/python/eduvpn_common/server.py +++ b/wrappers/python/eduvpn_common/server.py @@ -21,7 +21,13 @@ class Profile: :param: search_domains: List[str]: The list of DNS search domains """ - def __init__(self, identifier: str, display_name: str, default_gateway: bool, dns_search_domains: List[str]): + def __init__( + self, + identifier: str, + display_name: str, + default_gateway: bool, + dns_search_domains: List[str], + ): self.identifier = identifier self.display_name = display_name self.default_gateway = default_gateway @@ -405,9 +411,7 @@ def get_tokens(lib: CDLL, ptr: c_void_p) -> Optional[Token]: refresh = toks.refresh.decode("utf-8") expired = toks.expired lib.FreeTokens(ptr) - return Token( - access, refresh, expired - ) + return Token(access, refresh, expired) return None diff --git a/wrappers/python/example/main.py b/wrappers/python/example/main.py index 92472d2..68e1286 100644 --- a/wrappers/python/example/main.py +++ b/wrappers/python/example/main.py @@ -99,7 +99,9 @@ def do_secure_internet(edu: eduvpn.EduVPN) -> Optional[Config]: # The main entry point if __name__ == "__main__": - _eduvpn = eduvpn.EduVPN("org.eduvpn.app.linux", f"{commonver}-cli-py", "configs", "en") + _eduvpn = eduvpn.EduVPN( + "org.eduvpn.app.linux", f"{commonver}-cli-py", "configs", "en" + ) setup_callbacks(_eduvpn) # Register with the eduVPN-common library diff --git a/wrappers/python/setup.py b/wrappers/python/setup.py index 1bc565a..eb0b8ab 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,14 +99,16 @@ 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" if os.path.isdir(p): shutil.rmtree(p) os.makedirs(p) - shutil.copyfile(self.exports_lib_path + "/" + libpath, p+"/"+libpath.split("/")[-1]) + shutil.copyfile( + self.exports_lib_path + "/" + libpath, p + "/" + libpath.split("/")[-1] + ) _bdist_wheel.run(self) shutil.rmtree("eduvpn_common/lib/") diff --git a/wrappers/python/tests.py b/wrappers/python/tests.py index bd8b4eb..f7b8117 100644 --- a/wrappers/python/tests.py +++ b/wrappers/python/tests.py @@ -18,7 +18,9 @@ from selenium_eduvpn import login_eduvpn class ConfigTests(unittest.TestCase): def testConfig(self): - _eduvpn = eduvpn.EduVPN("org.letsconnect-vpn.app.linux", "0.1.0", "testconfigs", "en") + _eduvpn = eduvpn.EduVPN( + "org.letsconnect-vpn.app.linux", "0.1.0", "testconfigs", "en" + ) # This can throw an exception _eduvpn.register() @@ -40,7 +42,9 @@ class ConfigTests(unittest.TestCase): _eduvpn.deregister() def testDoubleRegister(self): - _eduvpn = eduvpn.EduVPN("org.letsconnect-vpn.app.linux", "0.1.0", "testconfigs", "en") + _eduvpn = eduvpn.EduVPN( + "org.letsconnect-vpn.app.linux", "0.1.0", "testconfigs", "en" + ) # This can throw an exception _eduvpn.register() # This should throw |
