diff --git a/pyproject.toml b/pyproject.toml index 59a3aa9..32e8aa3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,6 @@ build-backend = "setuptools.build_meta" [project] name = "py-gcode-metadata" -version = "0.2.0dev" description = "Python library for extraction of metadata from g-code files" readme = {file = "README.md", content-type="text/markdown"} license = {text = "LGPLv2+"} @@ -31,6 +30,10 @@ classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules", ] +dynamic = [ + "version", +] + [project.urls] "Homepage" = "https://github.com/prusa3d/gcode-metadata" "Bug Tracker" = "https://github.com/prusa3d/gcode-metadata/issues" diff --git a/setup.py b/setup.py index 92007ce..9358d14 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,6 @@ """Setup of PrusaConnect SDK for Printer.""" +import re + from setuptools import setup # type: ignore @@ -8,9 +10,14 @@ def doc(): return readme.read().strip() +METADATA = {} +with open("gcode_metadata/__init__.py", "r", encoding="utf-8") as info: + METADATA = dict(re.findall(r'__([a-z_]+)__ = "([^"]+)"', info.read())) + + setup( name='py-gcode-metadata', - version='0.2.0dev', + version=METADATA["version"], packages=['gcode_metadata'], url='https://github.com/prusa3d/gcode-metadata', license='LGPLv2+',