From 45384f3c8f9e5522622383d305c347c8681d6e90 Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Sun, 1 Dec 2019 19:41:16 -0800 Subject: [PATCH] Use __version__.py instead of VERSION.txt --- .gitignore | 2 +- .travis.yml | 2 +- jrnl/__init__.py | 11 ++++------- pyproject.toml | 1 - 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index b14464d0..a06808df 100644 --- a/.gitignore +++ b/.gitignore @@ -52,4 +52,4 @@ exp/ _extras/ *.sublime-* site/ -jrnl/VERSION.txt +jrnl/__version__.py diff --git a/.travis.yml b/.travis.yml index 3eda0c9a..215ef339 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ script: before_deploy: - pip install poetry - poetry config http-basic.pypi $PYPI_USER $PYPI_PASS - - echo $TRAVIS_TAG > jrnl/VERSION.txt + - echo __version__ = \"$TRAVIS_TAG\" > jrnl/__version__.py - poetry version $TRAVIS_TAG - poetry build deploy: diff --git a/jrnl/__init__.py b/jrnl/__init__.py index f1cdc3c4..f0f0af6d 100644 --- a/jrnl/__init__.py +++ b/jrnl/__init__.py @@ -2,11 +2,8 @@ # encoding: utf-8 import os - +try: + from .__version__ import __version__ +except ImportError: + __version__ = "source" __title__ = "jrnl" -__version__ = "source" - -version_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "VERSION.txt") -if os.path.exists(version_path): - with open(version_path) as version_file: - __version__ = version_file.read() diff --git a/pyproject.toml b/pyproject.toml index df18f9da..1b84acde 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,6 @@ license = "MIT" readme = "README.md" homepage = "https://jrnl.sh" repository = "https://github.com/jrnl-org/jrnl" -include = ["VERSION.txt"] [tool.poetry.dependencies] python = "^3.7"