Skip to content

Commit

Permalink
Locate VERSION file relative to the version.py module
Browse files Browse the repository at this point in the history
In case this is run from somewhere else than the libjuju top directory
(e.g. sphinx).
  • Loading branch information
cderici committed Jan 16, 2024
1 parent 0fe52cc commit ba64ece
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion juju/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 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"]
Expand All @@ -14,5 +15,5 @@
# 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 = './VERSION'
VERSION_FILE_PATH = pathlib.Path(__file__).parent.parent / 'VERSION'
CLIENT_VERSION = re.search(r'\d+\.\d+\.\d+', open(VERSION_FILE_PATH).read().strip()).group()

0 comments on commit ba64ece

Please sign in to comment.