Skip to content

Commit

Permalink
rename VERSION to _version_cache.py
Browse files Browse the repository at this point in the history
- made version cache a python file so it is included normally in the
package when built
- use import to read the cached version
  • Loading branch information
kosack committed Feb 6, 2017
1 parent ea50c1f commit 97392de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions ctapipe/_version_cache.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version='0.3.3.post29+gitea50c1f'
7 changes: 3 additions & 4 deletions ctapipe/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand All @@ -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")


Expand Down

0 comments on commit 97392de

Please sign in to comment.