From e17b48840eab93682a551b1c4e346f6abdfdd15f Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Sat, 11 Mar 2023 10:03:40 +0100 Subject: [PATCH] Use attribute instead of file for package version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that setuptools can use dynamic version detection, let’s use it! --- cairocffi/VERSION | 1 - cairocffi/__init__.py | 3 +-- pyproject.toml | 7 ++----- 3 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 cairocffi/VERSION diff --git a/cairocffi/VERSION b/cairocffi/VERSION deleted file mode 100644 index 88c5fb8..0000000 --- a/cairocffi/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.4.0 diff --git a/cairocffi/__init__.py b/cairocffi/__init__.py index ca4529c..f2704ff 100644 --- a/cairocffi/__init__.py +++ b/cairocffi/__init__.py @@ -11,12 +11,11 @@ import sys from ctypes.util import find_library -from pathlib import Path from . import constants from ._generated.ffi import ffi -VERSION = __version__ = (Path(__file__).parent / 'VERSION').read_text().strip() +VERSION = __version__ = '1.4.0' # supported version of cairo, used to be pycairo version too: version = '1.17.2' version_info = (1, 17, 2) diff --git a/pyproject.toml b/pyproject.toml index 41a43ee..944d7fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools", "cffi >= 1.1.0"] +requires = ["setuptools >= 61.0.0", "cffi >= 1.1.0"] build-backend = "setuptools.build_meta" [project] @@ -31,14 +31,11 @@ dependencies = [ dynamic = ["version"] [tool.setuptools.dynamic] -version = {file = ["cairocffi/VERSION"]} +version = {attr = "cairocffi.VERSION"} [tool.setuptools.packages.find] exclude = ["cairocffi._generated"] -[tool.setuptools.package-data] -cairocffi = ["VERSION"] - [project.urls] Documentation = "https://cairocffi.readthedocs.io/" Code = "https://github.com/Kozea/cairocffi/"