From ba64ece670859ae5495f8cedc4f1a3b00c40f6aa Mon Sep 17 00:00:00 2001 From: Caner Derici Date: Tue, 16 Jan 2024 14:16:37 -0700 Subject: [PATCH] Locate VERSION file relative to the version.py module In case this is run from somewhere else than the libjuju top directory (e.g. sphinx). --- juju/version.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/juju/version.py b/juju/version.py index 6e007a4c..e4289b46 100644 --- a/juju/version.py +++ b/juju/version.py @@ -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"] @@ -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()