Skip to content

Commit

Permalink
Use attribute instead of file for package version
Browse files Browse the repository at this point in the history
Now that setuptools can use dynamic version detection, let’s use it!
  • Loading branch information
liZe committed Mar 11, 2023
1 parent 5ea89ad commit e17b488
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
1 change: 0 additions & 1 deletion cairocffi/VERSION

This file was deleted.

3 changes: 1 addition & 2 deletions cairocffi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 2 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down Expand Up @@ -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/"
Expand Down

0 comments on commit e17b488

Please sign in to comment.