From 97392dec2098198f67a0515020d5079242a2eed9 Mon Sep 17 00:00:00 2001 From: Karl Kosack Date: Mon, 6 Feb 2017 17:06:34 +0100 Subject: [PATCH] rename VERSION to _version_cache.py - made version cache a python file so it is included normally in the package when built - use import to read the cached version --- ctapipe/_version_cache.py | 1 + ctapipe/version.py | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 ctapipe/_version_cache.py diff --git a/ctapipe/_version_cache.py b/ctapipe/_version_cache.py new file mode 100644 index 00000000000..ea8027d97cd --- /dev/null +++ b/ctapipe/_version_cache.py @@ -0,0 +1 @@ +version='0.3.3.post29+gitea50c1f' diff --git a/ctapipe/version.py b/ctapipe/version.py index e388b454a12..aafe8f7a4d0 100644 --- a/ctapipe/version.py +++ b/ctapipe/version.py @@ -30,7 +30,7 @@ __all__ = ("get_version",) CURRENT_DIRECTORY = path.dirname(path.abspath(__file__)) -VERSION_FILE = path.join(CURRENT_DIRECTORY, "VERSION") +VERSION_FILE = path.join(CURRENT_DIRECTORY, "_version_cache.py") GIT_COMMAND = "git" @@ -107,8 +107,7 @@ def format_git_describe(git_str, pep440=False): def read_release_version(): """Read version information from VERSION file""" try: - with open(VERSION_FILE, "r") as infile: - version = infile.read().strip() + from ._version_cache import version if len(version) == 0: version = None return version @@ -130,7 +129,7 @@ def update_release_version(pep440=False): """ version = get_version(pep440=pep440) with open(VERSION_FILE, "w") as outfile: - outfile.write(version) + outfile.write("version='{}'".format(version)) outfile.write("\n")