build: store version in pyproject.toml

This commit is contained in:
Enno Hermann 2024-05-07 11:52:50 +02:00
parent f4cacd7b7c
commit 259d8fc40b
8 changed files with 5 additions and 17 deletions

View File

@ -42,7 +42,7 @@ jobs:
branch=${github_ref#*refs/heads/} # strip prefix to get branch name
tags="${base}:${branch},${base}:${{ github.sha }},"
elif [[ "${{ startsWith(github.ref, 'refs/tags/') }}" = "true" ]]; then
VERSION="v$(cat TTS/VERSION)"
VERSION="v$(grep -m 1 version pyproject.toml | grep -P '\d+\.\d+\.\d+' -o)"
if [[ "${{ github.ref }}" != "refs/tags/${VERSION}" ]]; then
echo "Pushed tag does not match VERSION file. Aborting push."
exit 1

View File

@ -14,7 +14,7 @@ jobs:
- name: Verify tag matches version
run: |
set -ex
version=$(cat TTS/VERSION)
version=$(grep -m 1 version pyproject.toml | grep -P '\d+\.\d+\.\d+' -o)
tag="${GITHUB_REF/refs\/tags\/}"
if [[ "v$version" != "$tag" ]]; then
exit 1

View File

@ -3,7 +3,6 @@ include LICENSE.txt
include requirements.*.txt
include *.cff
include requirements.txt
include TTS/VERSION
recursive-include TTS *.json
recursive-include TTS *.html
recursive-include TTS *.png

View File

@ -1 +0,0 @@
0.23.1

View File

@ -1,6 +0,0 @@
import os
with open(os.path.join(os.path.dirname(__file__), "VERSION"), "r", encoding="utf-8") as f:
version = f.read().strip()
__version__ = version

View File

@ -10,6 +10,7 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import importlib.metadata
import os
import sys
@ -23,13 +24,10 @@ project = 'TTS'
copyright = "2021 Coqui GmbH, 2020 TTS authors"
author = 'Coqui GmbH'
with open("../../TTS/VERSION", "r") as ver:
version = ver.read().strip()
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
release = version
release = importlib.metadata.version(project)
# The main toctree document.
master_doc = "index"

View File

@ -12,6 +12,7 @@ include = ["TTS*"]
[project]
name = "coqui-tts"
version = "0.23.1"
description = "Deep learning for Text to Speech."
readme = "README.md"
requires-python = ">=3.9, <3.13"

View File

@ -31,8 +31,6 @@ from Cython.Build import cythonize
from setuptools import Extension, setup
cwd = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(cwd, "TTS", "VERSION")) as fin:
version = fin.read().strip()
class build_py(setuptools.command.build_py.build_py): # pylint: disable=too-many-ancestors
@ -70,7 +68,6 @@ exts = [
)
]
setup(
version=version,
# cython
include_dirs=numpy.get_include(),
ext_modules=cythonize(exts, language_level=3),