diff --git a/MANIFEST.in b/MANIFEST.in index c14d3fcb..aaca35be 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -include *.py CONTRIBUTORS LICENSE README.rst VERSION +include *.py CONTRIBUTORS LICENSE README.rst recursive-include juju *.py recursive-include examples *.py recursive-include docs *.rst diff --git a/Makefile b/Makefile index c2c25a30..5ecad85a 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ BIN := .tox/py3/bin PY := $(BIN)/python3 PIP := $(BIN)/pip3 -VERSION=$(shell cat VERSION) +VERSION := $(shell $(PY) -c "from version import CLIENT_VERSION; print(CLIENT_VERSION)") .PHONY: clean clean: diff --git a/VERSION b/VERSION deleted file mode 100644 index 7266d5bc..00000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -3.3.1.0 diff --git a/juju/version.py b/juju/version.py index e4289b46..e9b48bf5 100644 --- a/juju/version.py +++ b/juju/version.py @@ -1,19 +1,8 @@ # Copyright 2023 Canonical Ltd. # Licensed under the Apache V2, see LICENCE file for details. -import pathlib -import re - LTS_RELEASES = ["jammy", "focal", "bionic", "xenial", "trusty", "precise"] DEFAULT_ARCHITECTURE = 'amd64' -# CLIENT_VERSION (that's read from the VERSION file) is the highest Juju server -# version that this client supports. -# Note that this is a ceiling. CLIENT_VERSION <= juju-controller-version works. -# For CLIENT_VERSION < juju-controller-version (strictly smaller), we emit a warning -# to update the client to the latest. -# However, for any CLIENT_VERSION > juju-controller-version, a "client incompatible -# with server" will be returned by the juju controller. -VERSION_FILE_PATH = pathlib.Path(__file__).parent.parent / 'VERSION' -CLIENT_VERSION = re.search(r'\d+\.\d+\.\d+', open(VERSION_FILE_PATH).read().strip()).group() +CLIENT_VERSION = "3.3.1.0" diff --git a/setup.py b/setup.py index 6c9165ff..a2e8ee94 100644 --- a/setup.py +++ b/setup.py @@ -5,6 +5,8 @@ from setuptools import find_packages, setup +from juju.version import CLIENT_VERSION + here = Path(__file__).absolute().parent readme = here / 'docs' / 'readme.rst' changelog = here / 'docs' / 'changelog.rst' @@ -13,11 +15,10 @@ changelog.read_text() ) long_description_content_type = 'text/x-rst' -version = here / 'VERSION' setup( name='juju', - version=version.read_text().strip(), + version=CLIENT_VERSION.strip(), packages=find_packages( exclude=["*.tests", "*.tests.*", "tests.*", "tests"]), package_data={'juju': ['py.typed']},