Skip to content

Commit 5facbc6

Browse files
committed
Switch from 'semantic-release' to 'setuptools-scm'
1 parent 70154c7 commit 5facbc6

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
[build-system]
2-
requires = ["setuptools>=46.4", "wheel"]
2+
requires = ["setuptools>=46.4", "wheel", "setuptools_scm[toml]>=4.1"]
33
build-backend = "setuptools.build_meta"
44

5-
[tool.semantic_release]
6-
version_variable = ["src/sphinxcontrib/email/__init__.py:__version__"]
7-
commit_subject = "Bump version to v{version}"
5+
[tool.setuptools_scm]
86

97
[tool.black]
108
line-length = 88

setup.cfg

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[metadata]
22
name = sphinxcontrib-email
3-
version = attr: sphinxcontrib.email.__version__
43
project_urls =
54
GitHub: repo = https://github.com/sphinx-contrib/email
65
GitHub: issues = https://github.com/sphinx-contrib/email/issues
@@ -31,15 +30,17 @@ classifiers =
3130
release = egg_info -RDb '' register bdist_egg sdist upload
3231

3332
[options]
34-
platforms = any
3533
include_package_data = True
3634
install_requires =
3735
lxml>=4.5.2
3836
Sphinx>=1.8
3937
package_dir =
4038
= src
4139
packages = find_namespace:
40+
platforms = any
4241
python_requires = >=3.7
42+
setup_requires =
43+
setuptools_scm>=4.1
4344
zip_safe = False
4445

4546
[options.packages.find]

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# -*- coding: utf-8 -*-
22
from setuptools import setup
33

4-
setup()
4+
setup(use_scm_version=True)

src/sphinxcontrib/email/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@
88
from .handlers import html_page_context_handler
99
from .roles import EmailRole
1010

11-
logger = sphinx.util.logging.getLogger(__name__)
11+
try:
12+
from importlib import metadata
13+
except ImportError:
14+
import importlib_metadata as metadata
15+
16+
try:
17+
__version__ = ".".join(metadata.version("sphinxcontrib-email").split(".")[:3])
18+
except metadata.PackageNotFoundError:
19+
pass
1220

13-
__version__ = "0.3.3"
21+
logger = sphinx.util.logging.getLogger(__name__)
1422

1523

1624
def setup(app: Sphinx) -> dict[str, Any]:

0 commit comments

Comments
 (0)