Make pyproject.toml's version dynamic

This commit is contained in:
Branch Vincent 2024-10-23 15:19:02 -07:00
parent 47da2a6967
commit 0e40ec657e
No known key found for this signature in database
2 changed files with 5 additions and 6 deletions

View File

@ -15,15 +15,11 @@ import platform
import signal import signal
import sys import sys
import tracemalloc import tracemalloc
from importlib import metadata
# Global name # Global name
# Version should start and end with a numerical char # Version should start and end with a numerical char
# See https://packaging.python.org/specifications/core-metadata/#version # See https://packaging.python.org/specifications/core-metadata/#version
try: __version__ = "4.3.0_dev02"
__version__ = metadata.version("glances")
except metadata.PackageNotFoundError:
__version__ = "0.0.0+unknown"
__apiversion__ = '4' __apiversion__ = '4'
__author__ = 'Nicolas Hennion <nicolas@nicolargo.com>' __author__ = 'Nicolas Hennion <nicolas@nicolargo.com>'
__license__ = 'LGPLv3' __license__ = 'LGPLv3'

View File

@ -29,13 +29,13 @@ dependencies = [
"requests; platform_system == 'Windows'", "requests; platform_system == 'Windows'",
] ]
description = "A cross-platform curses-based monitoring tool" description = "A cross-platform curses-based monitoring tool"
dynamic = ["version"]
keywords = ["cli", "curses", "monitoring", "system"] keywords = ["cli", "curses", "monitoring", "system"]
license = {text = "LGPLv3"} license = {text = "LGPLv3"}
name = "Glances" name = "Glances"
readme = "README.rst" readme = "README.rst"
requires-python = ">=3.8" requires-python = ">=3.8"
urls.Homepage = "https://github.com/nicolargo/glances" urls.Homepage = "https://github.com/nicolargo/glances"
version = "4.3.0_dev02"
[project.optional-dependencies] [project.optional-dependencies]
action = ["chevron"] action = ["chevron"]
@ -86,6 +86,9 @@ glances = "glances:main"
] ]
"share/man/man1" = ["docs/man/glances.1"] "share/man/man1" = ["docs/man/glances.1"]
[tool.setuptools.dynamic]
version = { attr = "glances.__version__" }
[tool.setuptools.packages.find] [tool.setuptools.packages.find]
include = ["glances*"] include = ["glances*"]