diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-10-23 08:21:22 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-10-23 08:30:15 +0200 |
| commit | 67bd78f2e626602d8392482250d4328eb3b1b3a6 (patch) | |
| tree | f816ec7486b404749f0d343895bd7333490d5279 | |
| parent | 3e8e89dd25fefcea14e3b7f3665fd99d401f9cb0 (diff) | |
All: Make it easier to update the version
| -rw-r--r-- | cmd/cli/main.go | 3 | ||||
| -rw-r--r-- | docs/src/gettingstarted/building/example.md | 3 | ||||
| -rw-r--r-- | exports/common.mk | 2 | ||||
| -rw-r--r-- | internal/http/http.go | 5 | ||||
| -rw-r--r-- | internal/version/version.go | 3 | ||||
| -rw-r--r-- | wrappers/python/example/main.py | 3 |
6 files changed, 13 insertions, 6 deletions
diff --git a/cmd/cli/main.go b/cmd/cli/main.go index 02c8a7b..6945128 100644 --- a/cmd/cli/main.go +++ b/cmd/cli/main.go @@ -10,6 +10,7 @@ import ( "github.com/eduvpn/eduvpn-common/client" "github.com/eduvpn/eduvpn-common/internal/oauth" "github.com/eduvpn/eduvpn-common/internal/server" + "github.com/eduvpn/eduvpn-common/internal/version" "github.com/go-errors/errors" ) @@ -124,7 +125,7 @@ func printConfig(url string, srvType ServerTypes) { err := c.Register( "org.eduvpn.app.linux", - "1.1.2-cli", + fmt.Sprintf("%s-cli", version.Version), "configs", "en", func(old client.FSMStateID, new client.FSMStateID, data interface{}) bool { diff --git a/docs/src/gettingstarted/building/example.md b/docs/src/gettingstarted/building/example.md index 1f541b2..902b419 100644 --- a/docs/src/gettingstarted/building/example.md +++ b/docs/src/gettingstarted/building/example.md @@ -23,6 +23,7 @@ make -C wrappers/python 5. Install the wheel using pip ```bash -pip install wrappers/python/dist/eduvpncommon-1.1.2-py3-none-linux_x86_64.whl +# x.x.x is the version here +pip install wrappers/python/dist/eduvpncommon-x.x.x-py3-none-linux_x86_64.whl ``` Note that the name of your wheel changes on the platform and version. diff --git a/exports/common.mk b/exports/common.mk index 940b3d4..d188cb9 100644 --- a/exports/common.mk +++ b/exports/common.mk @@ -19,7 +19,7 @@ LIB_SUFFIX ?= .so endif # Current version -VERSION = 1.1.2 +VERSION := $(shell grep -o 'const Version = "[^"]*' ../internal/version/version.go | cut -d '"' -f 2) # Library name without prefixes/suffixes LIB_NAME ?= eduvpn_common diff --git a/internal/http/http.go b/internal/http/http.go index f3f7563..49e5f4f 100644 --- a/internal/http/http.go +++ b/internal/http/http.go @@ -12,6 +12,7 @@ import ( "time" "github.com/go-errors/errors" + "github.com/eduvpn/eduvpn-common/internal/version" ) // UserAgent is the user agent that is used for requests @@ -247,6 +248,6 @@ func (e *StatusError) Error() string { } // RegisterAgent registers the user agent for client and version -func RegisterAgent(client string, version string) { - UserAgent = fmt.Sprintf("%s/%s %s", client, version, "eduvpn-common/1.1.2") +func RegisterAgent(client string, verApp string) { + UserAgent = fmt.Sprintf("%s/%s eduvpn-common/%s", client, verApp, version.Version) } diff --git a/internal/version/version.go b/internal/version/version.go new file mode 100644 index 0000000..69f6ff0 --- /dev/null +++ b/internal/version/version.go @@ -0,0 +1,3 @@ +package version + +const Version = "1.1.2" diff --git a/wrappers/python/example/main.py b/wrappers/python/example/main.py index 6df3b40..92472d2 100644 --- a/wrappers/python/example/main.py +++ b/wrappers/python/example/main.py @@ -1,3 +1,4 @@ +from eduvpn_common import __version__ as commonver import eduvpn_common.main as eduvpn from eduvpn_common.state import State, StateType from eduvpn_common.server import Config, Profiles @@ -98,7 +99,7 @@ def do_secure_internet(edu: eduvpn.EduVPN) -> Optional[Config]: # The main entry point if __name__ == "__main__": - _eduvpn = eduvpn.EduVPN("org.eduvpn.app.linux", "1.1.2-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 |
