Skip to content

Commit fe84880

Browse files
committed
Move the version info into the source code instead of static VERSION
file This fixes #1025 by removing the dependency to the external static VERSION file from within the project, allowing it to work in environments where pylibjuju is installed as a dependency library. Note that this changes the release process. In particular where we need to manually change the version information is moved into version.py (the release process document will be updated) This also removes the VERSION file.
1 parent 8132055 commit fe84880

5 files changed

Lines changed: 6 additions & 17 deletions

File tree

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include *.py CONTRIBUTORS LICENSE README.rst VERSION
1+
include *.py CONTRIBUTORS LICENSE README.rst
22
recursive-include juju *.py
33
recursive-include examples *.py
44
recursive-include docs *.rst

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
BIN := .tox/py3/bin
22
PY := $(BIN)/python3
33
PIP := $(BIN)/pip3
4-
VERSION=$(shell cat VERSION)
4+
VERSION := $(shell $(PY) -c "from version import CLIENT_VERSION; print(CLIENT_VERSION)")
55

66
.PHONY: clean
77
clean:

VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

juju/version.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
11
# Copyright 2023 Canonical Ltd.
22
# Licensed under the Apache V2, see LICENCE file for details.
33

4-
import pathlib
5-
import re
6-
74
LTS_RELEASES = ["jammy", "focal", "bionic", "xenial", "trusty", "precise"]
85

96
DEFAULT_ARCHITECTURE = 'amd64'
107

11-
# CLIENT_VERSION (that's read from the VERSION file) is the highest Juju server
12-
# version that this client supports.
13-
# Note that this is a ceiling. CLIENT_VERSION <= juju-controller-version works.
14-
# For CLIENT_VERSION < juju-controller-version (strictly smaller), we emit a warning
15-
# to update the client to the latest.
16-
# However, for any CLIENT_VERSION > juju-controller-version, a "client incompatible
17-
# with server" will be returned by the juju controller.
18-
VERSION_FILE_PATH = pathlib.Path(__file__).parent.parent / 'VERSION'
19-
CLIENT_VERSION = re.search(r'\d+\.\d+\.\d+', open(VERSION_FILE_PATH).read().strip()).group()
8+
CLIENT_VERSION = "3.3.1.0"

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
from setuptools import find_packages, setup
77

8+
from juju.version import CLIENT_VERSION
9+
810
here = Path(__file__).absolute().parent
911
readme = here / 'docs' / 'readme.rst'
1012
changelog = here / 'docs' / 'changelog.rst'
@@ -13,11 +15,10 @@
1315
changelog.read_text()
1416
)
1517
long_description_content_type = 'text/x-rst'
16-
version = here / 'VERSION'
1718

1819
setup(
1920
name='juju',
20-
version=version.read_text().strip(),
21+
version=CLIENT_VERSION.strip(),
2122
packages=find_packages(
2223
exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
2324
package_data={'juju': ['py.typed']},

0 commit comments

Comments
 (0)