Skip to content

Commit fa51284

Browse files
authored
Remove use of pbr (#119)
1 parent 1f194f7 commit fa51284

File tree

6 files changed

+26
-20
lines changed

6 files changed

+26
-20
lines changed

.gitignore

+1-5
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,4 @@ coverage.xml
5151

5252
# Sphinx documentation
5353
doc/build/
54-
55-
# pbr stuff
56-
AUTHORS
57-
ChangeLog
58-
.eggs
54+
src/doc8/_version.py

doc/requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
pbr # Apache
21
sphinx>=1.8.0 # BSD
32
sphinx_rtd_theme>=0.4.0 # MIT

pyproject.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ requires = [
77
]
88
build-backend = "setuptools.build_meta"
99

10-
[tool.setuptools_scm]
11-
local_scheme = "no-local-version"
12-
1310
[project]
1411
name = "doc8"
1512
description = "Style checker for Sphinx (or other) RST documentation"
@@ -75,7 +72,7 @@ filterwarnings = [
7572

7673
[[tool.mypy.overrides]]
7774
module = [
78-
"pbr",
75+
"doc8._version",
7976
"restructuredtext_lint",
8077
"stevedore",
8178
]
@@ -91,7 +88,6 @@ disable = [
9188
"missing-class-docstring",
9289
"missing-function-docstring",
9390
"missing-module-docstring",
94-
"no-self-use",
9591
"too-few-public-methods",
9692
"too-many-arguments",
9793
"too-many-branches",
@@ -117,3 +113,7 @@ license-files = ["LICENSE"]
117113
[tool.setuptools.packages.find]
118114
where = ["src"]
119115
namespaces = false
116+
117+
[tool.setuptools_scm]
118+
local_scheme = "no-local-version"
119+
write_to = "src/doc8/_version.py"

src/doc8/__init__.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
from .main import doc8 # noqa
1+
"""doc8 - A docutils linter."""
2+
from __future__ import annotations
3+
from doc8.version import __version__
4+
from doc8.main import doc8 # noqa
5+
6+
7+
__all__ = ("__version__",)

src/doc8/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ def main():
522522
)
523523
args = vars(parser.parse_args())
524524
if args.get("version"):
525-
print(version.version_string)
525+
print(version.__version__)
526526
return 0
527527

528528
result = doc8(args)

src/doc8/version.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,18 @@
1414
# License for the specific language governing permissions and limitations
1515
# under the License.
1616

17+
"""doc8 version information."""
1718
try:
18-
from pbr import version as pbr_version
19+
from ._version import version as __version__
20+
except ImportError: # pragma: no branch
1921

20-
_version_info = pbr_version.VersionInfo("doc8")
21-
version_string = _version_info.version_string()
22-
except ImportError:
23-
import pkg_resources
22+
try:
23+
import pkg_resources
2424

25-
_version_info = pkg_resources.get_distribution("doc8")
26-
version_string = _version_info.version
25+
__version__ = pkg_resources.get_distribution("doc8").version
26+
except Exception: # pylint: disable=broad-except
27+
# this is the fallback SemVer version picked by setuptools_scm when tag
28+
# information is not available.
29+
__version__ = "0.1.dev1"
30+
31+
__all__ = ("__version__",)

0 commit comments

Comments
 (0)