diff options
| -rw-r--r-- | eduvpncommon.spec | 2 | ||||
| -rw-r--r-- | exports/Makefile | 2 | ||||
| -rw-r--r-- | exports/common.mk | 6 | ||||
| -rw-r--r-- | wrappers/python/eduvpn_common/__init__.py | 1 | ||||
| -rw-r--r-- | wrappers/python/eduvpn_common/loader.py | 5 | ||||
| -rw-r--r-- | wrappers/python/eduvpn_common/main.py | 4 | ||||
| -rwxr-xr-x | wrappers/python/setup.py | 22 |
7 files changed, 23 insertions, 19 deletions
diff --git a/eduvpncommon.spec b/eduvpncommon.spec index 99ed4af..401a475 100644 --- a/eduvpncommon.spec +++ b/eduvpncommon.spec @@ -41,7 +41,7 @@ popd %package -n python3-%{libname} BuildArch: noarch -Requires: %{name} +Requires: %{name} >= 0.1.0, %{name} < 0.2.0 Summary: Python3 eduvpncommon wrapper %description -n python3-%{libname} diff --git a/exports/Makefile b/exports/Makefile index 1434f8b..6608ee0 100644 --- a/exports/Makefile +++ b/exports/Makefile @@ -18,7 +18,7 @@ endif # This extra target prevents unnecessary rebuild lib/$(GOOS)/$(GOARCH)/$(LIB_FILE): .. CGO_ENABLED=1 go build -o $@ -buildmode=c-shared . - mv lib/$(GOOS)/$(GOARCH)/$(LIB_PREFIX)$(LIB_NAME).h lib/$(GOOS)/$(GOARCH)/$(LIB_NAME).h || true # Normalize header name + mv lib/$(GOOS)/$(GOARCH)/$(LIB_PREFIX)$(LIB_NAME_VERSION).h lib/$(GOOS)/$(GOARCH)/$(LIB_NAME).h || true # Normalize header name clean: rm -rf ../exports/lib/* diff --git a/exports/common.mk b/exports/common.mk index c1e2a7e..c5386ae 100644 --- a/exports/common.mk +++ b/exports/common.mk @@ -18,10 +18,14 @@ LIB_PREFIX ?= lib LIB_SUFFIX ?= .so endif +# Current version +VERSION = 0.1.0 + # Library name without prefixes/suffixes LIB_NAME ?= eduvpn_common +LIB_NAME_VERSION ?= $(LIB_NAME)-$(VERSION) # Library file name -LIB_FILE ?= $(LIB_PREFIX)$(LIB_NAME)$(LIB_SUFFIX) +LIB_FILE ?= $(LIB_PREFIX)$(LIB_NAME_VERSION)$(LIB_SUFFIX) # Get relative exports/ directory when included from a wrapper, without trailing slash override EXPORTS_PATH = $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) diff --git a/wrappers/python/eduvpn_common/__init__.py b/wrappers/python/eduvpn_common/__init__.py index e69de29..3dc1f76 100644 --- a/wrappers/python/eduvpn_common/__init__.py +++ b/wrappers/python/eduvpn_common/__init__.py @@ -0,0 +1 @@ +__version__ = "0.1.0" diff --git a/wrappers/python/eduvpn_common/loader.py b/wrappers/python/eduvpn_common/loader.py index bce2638..99f5eb6 100644 --- a/wrappers/python/eduvpn_common/loader.py +++ b/wrappers/python/eduvpn_common/loader.py @@ -2,10 +2,11 @@ from ctypes import * from collections import defaultdict import pathlib import platform +from eduvpn_common import __version__ from eduvpn_common.types import * -def load_lib(version: str): +def load_lib(): lib_prefixes = defaultdict( lambda: "lib", { @@ -24,7 +25,7 @@ def load_lib(version: str): os = platform.system().lower() libname = "eduvpn_common" - libfile = f"{lib_prefixes[os]}{libname}{lib_suffixes[os]}" + libfile = f"{lib_prefixes[os]}{libname}-{__version__}{lib_suffixes[os]}" lib = None diff --git a/wrappers/python/eduvpn_common/main.py b/wrappers/python/eduvpn_common/main.py index 1b18fb0..7cb4b5e 100644 --- a/wrappers/python/eduvpn_common/main.py +++ b/wrappers/python/eduvpn_common/main.py @@ -9,8 +9,6 @@ from eduvpn_common.state import State, StateType eduvpn_objects = {} -VERSION = "0.1.0" - def add_as_global_object(eduvpn) -> bool: global eduvpn_objects @@ -39,7 +37,7 @@ class EduVPN(object): self.config_directory = config_directory # Load the library - self.lib = load_lib(VERSION) + self.lib = load_lib() initialize_functions(self.lib) self.event_handler = EventHandler(self.lib) diff --git a/wrappers/python/setup.py b/wrappers/python/setup.py index 499627e..e03fa9a 100755 --- a/wrappers/python/setup.py +++ b/wrappers/python/setup.py @@ -10,43 +10,43 @@ from setuptools import setup from wheel.bdist_wheel import bdist_wheel as _bdist_wheel _libname = "eduvpn_common" - +__version__ = "0.1.0" def getlibpath(plat_name: str) -> typing.Union[str, None]: """Get library path for plat_name relative to exports/lib/ folder.""" - _plat_map = defaultdict( + plat_map = defaultdict( lambda: plat_name, { "win32": "win-x86", }, ) - plat_split = _plat_map[plat_name].split("-", 1) + plat_split = plat_map[plat_name].split("-", 1) if len(plat_split) != 2: return None plat_os, plat_arch = plat_split - _os_map = defaultdict( + os_map = defaultdict( lambda: plat_os, { "win": "windows", }, ) - _lib_prefixes = defaultdict( + lib_prefixes = defaultdict( lambda: "lib", { "windows": "", }, ) - _lib_suffixes = defaultdict( + lib_suffixes = defaultdict( lambda: ".so", { "windows": ".dll", "darwin": ".dylib", }, ) - _arch_map = defaultdict( + arch_map = defaultdict( lambda: plat_arch, { "aarch64_be": "arm64", @@ -63,10 +63,10 @@ def getlibpath(plat_name: str) -> typing.Union[str, None]: }, ) - processed_os = _os_map[plat_os] + processed_os = os_map[plat_os] return ( - f"{processed_os}/{_arch_map[plat_arch]}/" - f"{_lib_prefixes[processed_os]}{_libname}{_lib_suffixes[processed_os]}" + f"{processed_os}/{arch_map[plat_arch]}/" + f"{lib_prefixes[processed_os]}{_libname}-{__version__}{lib_suffixes[processed_os]}" ) @@ -101,7 +101,7 @@ class bdist_wheel(_bdist_wheel): setup( name="eduvpn_common", - version="0.1.0", + version=__version__, packages=["eduvpn_common"], python_requires=">=3.6", package_dir={"eduvpn_common": "eduvpn_common"}, |
