Skip to content

Commit c21c3e8

Browse files
dbarnettsnu5mumr1k
authored andcommitted
Get version from setuptools-scm, remove VERSION.txt
1 parent 135b517 commit c21c3e8

File tree

6 files changed

+11
-12
lines changed

6 files changed

+11
-12
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/deb_dist/
2+
/vimdoc/_version.py
23

34
# Python.gitignore:
45
# Byte-compiled / optimized / DLL files

MANIFEST.in

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
include README.md
2-
include vimdoc/VERSION.txt
32

43
graft tests

VERSION.txt

-1
This file was deleted.

pyproject.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=61.2"]
2+
requires = ["setuptools>=64", "setuptools-scm>=8"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -26,5 +26,5 @@ completion = ["shtab"]
2626
packages = ["vimdoc"]
2727
script-files = ["scripts/vimdoc"]
2828

29-
[tool.setuptools.dynamic]
30-
version = { file = "VERSION.txt" }
29+
[tool.setuptools_scm]
30+
version_file = "vimdoc/_version.py"

vimdoc/VERSION.txt

-1
This file was deleted.

vimdoc/__init__.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
"""Vimdoc: Vim helpfile generation."""
22
import sys
33

4+
try:
5+
from vimdoc._version import __version__ as __version__
6+
except ImportError:
7+
import warnings
8+
warnings.warn('Failed to load __version__ from setuptools-scm')
9+
__version__ = '__unknown__'
10+
411

512
# Don't even try to run under python 2 or earlier. It will seem to work but fail
613
# in corner cases with strange encoding errors.
714
if sys.version_info[0] < 3:
815
raise ImportError('Python < 3 is unsupported')
916

1017

11-
def __read_version_txt():
12-
import pkgutil
13-
return pkgutil.get_data('vimdoc', 'VERSION.txt').decode('utf-8').strip()
14-
15-
__version__ = __read_version_txt()
16-
1718
SECTION = 'SECTION'
1819
BACKMATTER = 'BACKMATTER'
1920
EXCEPTION = 'EXCEPTION'

0 commit comments

Comments
 (0)