Skip to content

Commit 5906f16

Browse files
authored
v1.5.3
2 parents 0da083f + b1d5843 commit 5906f16

File tree

4 files changed

+30
-31
lines changed

4 files changed

+30
-31
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
![PyPI - Status](https://img.shields.io/pypi/status/pyTooling.TerminalUI?logo=PyPI&logoColor=FBE072)
1515
[![Libraries.io status for latest release](https://img.shields.io/librariesio/release/pypi/pyTooling.TerminalUI?logo=librariesdotio)](https://libraries.io/github/pyTooling/pyTooling.TerminalUI)
1616
[![Requires.io](https://img.shields.io/requires/github/pyTooling/pyTooling.TerminalUI)](https://requires.io/github/pyTooling/pyTooling.TerminalUI/requirements/?branch=main)
17-
[![Read the Docs](https://img.shields.io/readthedocs/pyterminalui?label=ReadTheDocs&logo=readthedocs)](https://pyTerminalUI.readthedocs.io/)
1817
[![Documentation License](https://img.shields.io/badge/doc%20license-CC--BY%204.0-green?logo=readthedocs)](doc/Doc-License.rst)
1918
[![Documentation - Read Now!](https://img.shields.io/badge/doc-read%20now%20%E2%9E%9A-blueviolet?logo=readthedocs)](https://pyTooling.GitHub.io/pyTooling.TerminalUI)
2019

doc/conf.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# add these directories to sys.path here. If the directory is relative to the
1111
# documentation root, use os.path.abspath to make it absolute, like shown here.
1212
#
13+
from ast import parse as ast_parse, iter_child_nodes, Assign, Constant, Name
1314
from json import loads
1415
from os.path import abspath
1516
from pathlib import Path
@@ -21,40 +22,39 @@
2122
sys_path.insert(0, abspath('_extensions'))
2223
#sys_path.insert(0, os.path.abspath('_themes/sphinx_rtd_theme'))
2324

24-
25-
# ==============================================================================
26-
# Project information
27-
# ==============================================================================
28-
project = 'pyTooling.TerminalUI'
29-
copyright = '2007-2021, Patrick Lehmann'
30-
author = 'Patrick Lehmann'
31-
3225
# ==============================================================================
33-
# Versioning
26+
# Project information and versioning
3427
# ==============================================================================
3528
# The version info for the project you're documenting, acts as replacement for
3629
# |version| and |release|, also used in various other places throughout the
3730
# built documents.
38-
from subprocess import check_output
31+
project = "pyTooling.TerminalUI"
32+
33+
__author = None
34+
__copyright = None
35+
__version = None
36+
37+
# Read __version__ from source file
38+
versionFile = Path(f"../{project.replace('.', '/')}/__init__.py")
39+
with versionFile.open("r") as file:
40+
for item in iter_child_nodes(ast_parse(file.read())):
41+
if isinstance(item, Assign) and len(item.targets) == 1:
42+
target = item.targets[0]
43+
value = item.value
44+
if isinstance(target, Name) and target.id == "__author__" and isinstance(value, Constant) and isinstance(value.value, str):
45+
__author = value.value
46+
if isinstance(target, Name) and target.id == "__copyright__" and isinstance(value, Constant) and isinstance(value.value, str):
47+
__copyright = value.value
48+
if isinstance(target, Name) and target.id == "__version__" and isinstance(value, Constant) and isinstance(value.value, str):
49+
__version = value.value
50+
if __version is None:
51+
raise AssertionError(f"Could not extract '__version__' from '{versionFile}'.")
52+
53+
author = __author
54+
copyright = __copyright
55+
version = ".".join(__version.split(".")[:2]) # e.g. 2.3 The short X.Y version.
56+
release = __version
3957

40-
def _IsUnderGitControl():
41-
return (check_output(["git", "rev-parse", "--is-inside-work-tree"], universal_newlines=True).strip() == "true")
42-
43-
def _LatestTagName():
44-
return check_output(["git", "describe", "--abbrev=0", "--tags"], universal_newlines=True).strip()
45-
46-
# The full version, including alpha/beta/rc tags
47-
version = "1.5" # The short X.Y version.
48-
release = "1.5.2" # The full version, including alpha/beta/rc tags.
49-
try:
50-
if _IsUnderGitControl:
51-
latestTagName = _LatestTagName()[1:] # remove prefix "v"
52-
versionParts = latestTagName.split("-")[0].split(".")
53-
54-
version = ".".join(versionParts[:2])
55-
release = latestTagName # ".".join(versionParts[:3])
56-
except:
57-
pass
5858

5959
# ==============================================================================
6060
# Miscellaneous settings

pyTooling/TerminalUI/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
__email__ = "Paebbels@gmail.com"
4040
__copyright__ = "2007-2021, Patrick Lehmann"
4141
__license__ = "Apache License, Version 2.0"
42-
__version__ = "1.5.2"
42+
__version__ = "1.5.3"
4343

4444

4545
@export

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
__version = None
4646

4747
# Read __version__ from source file
48-
versionFile = Path(f"{projectName}/__init__.py")
48+
versionFile = Path(f"{prefix}/{projectName}/__init__.py")
4949
with versionFile.open("r") as file:
5050
for item in iter_child_nodes(ast_parse(file.read())):
5151
if isinstance(item, Assign) and len(item.targets) == 1:

0 commit comments

Comments
 (0)