Skip to content

Commit f1f35bd

Browse files
Merge pull request #724 from RonnyPfannschmidt/fix-722-self-bootstrap
minimize bootstrap - fixes #722 and #722
2 parents f807bfe + 64058ad commit f1f35bd

18 files changed

+89
-35
lines changed

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
v7.0.2
2+
======
3+
4+
* fix #723 and #722: remove bootstrap dependencies
5+
* bugfix: ensure we read the distribution name from setup.cfg
6+
if needed even for pyproject
7+
*
8+
19
v7.0.1
210
=======
311

pyproject.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
[build-system]
22
requires = [
33
"setuptools>=45",
4-
"tomli>=1.0",
54
"packaging>=20.0",
6-
"typing_extensions",
7-
"importlib_metadata",
85
]
96
build-backend = "setuptools.build_meta"

src/setuptools_scm/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from typing import Callable
1111
from typing import TYPE_CHECKING
1212

13-
from . import _types as _t
1413
from ._entrypoints import _call_entrypoint_fn
1514
from ._entrypoints import _version_from_entrypoints
1615
from ._overrides import _read_pretended_version_for
@@ -33,6 +32,7 @@
3332
if TYPE_CHECKING:
3433
from typing import NoReturn
3534

35+
from . import _types as _t
3636

3737
TEMPLATES = {
3838
".py": """\

src/setuptools_scm/_entrypoints.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@
66
from typing import overload
77
from typing import TYPE_CHECKING
88

9-
from typing_extensions import Protocol
10-
11-
from . import _types as _t
129
from .utils import function_has_arg
1310
from .utils import trace
1411
from .version import ScmVersion
1512

1613
if TYPE_CHECKING:
1714
from .config import Configuration
15+
from typing_extensions import Protocol
16+
from . import _types as _t
1817
else:
1918
Configuration = Any
2019

20+
class Protocol:
21+
pass
22+
2123

2224
class MaybeConfigFunction(Protocol):
2325
__name__: str
@@ -71,7 +73,17 @@ def _version_from_entrypoints(
7173
try:
7274
from importlib.metadata import entry_points # type: ignore
7375
except ImportError:
74-
from importlib_metadata import entry_points
76+
try:
77+
from importlib_metadata import entry_points
78+
except ImportError:
79+
from collections import defaultdict
80+
81+
def entry_points() -> dict[str, list[_t.EntrypointProtocol]]:
82+
warnings.warn(
83+
"importlib metadata missing, "
84+
"this may happen at build time for python3.7"
85+
)
86+
return defaultdict(list)
7587

7688

7789
def iter_entry_points(

src/setuptools_scm/_types.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from typing import Any
44
from typing import Callable
55
from typing import List
6-
from typing import NamedTuple
76
from typing import TYPE_CHECKING
87
from typing import TypeVar
98
from typing import Union
@@ -22,12 +21,6 @@
2221
VERSION_SCHEME = Union[str, Callable[["version.ScmVersion"], str]]
2322

2423

25-
class CmdResult(NamedTuple):
26-
out: str
27-
err: str
28-
returncode: int
29-
30-
3124
class EntrypointProtocol(Protocol):
3225
name: str
3326

src/setuptools_scm/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
from typing import TYPE_CHECKING
1313
from typing import Union
1414

15-
from . import _types as _t
1615
from ._version_cls import NonNormalizedVersion
1716
from ._version_cls import Version
1817
from .utils import trace
1918

2019

2120
if TYPE_CHECKING:
21+
from . import _types as _t
2222
from setuptools_scm.version import ScmVersion
2323

2424
DEFAULT_TAG_REGEX = r"^(?:[\w-]+-)?(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$"

src/setuptools_scm/discover.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
import os
44
from typing import Iterable
55
from typing import Iterator
6+
from typing import TYPE_CHECKING
67

7-
from . import _types as _t
8+
if TYPE_CHECKING:
9+
from . import _types as _t
810
from .config import Configuration
911
from .utils import trace
1012

src/setuptools_scm/file_finder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
if TYPE_CHECKING:
77
from typing_extensions import TypeGuard
8+
from . import _types as _t
89

9-
from . import _types as _t
1010
from .utils import trace
1111

1212

src/setuptools_scm/file_finder_git.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
import subprocess
66
import tarfile
77
from typing import IO
8+
from typing import TYPE_CHECKING
89

9-
from . import _types as _t
1010
from .file_finder import is_toplevel_acceptable
1111
from .file_finder import scm_find_files
1212
from .utils import do_ex
1313
from .utils import trace
1414

15+
if TYPE_CHECKING:
16+
from . import _types as _t
17+
18+
1519
log = logging.getLogger(__name__)
1620

1721

src/setuptools_scm/git.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
from typing import Callable
1212
from typing import TYPE_CHECKING
1313

14-
from . import _types as _t
1514
from .config import Configuration
1615
from .scm_workdir import Workdir
16+
from .utils import _CmdResult
1717
from .utils import data_from_mime
1818
from .utils import do_ex
1919
from .utils import require_command
@@ -23,6 +23,8 @@
2323
from .version import tags_to_versions
2424

2525
if TYPE_CHECKING:
26+
from . import _types as _t
27+
2628
from setuptools_scm.hg_git import GitWorkdirHgClient
2729

2830
REF_TAG_RE = re.compile(r"(?<=\btag: )([^,]+)\b")
@@ -72,7 +74,7 @@ def from_potential_worktree(cls, wd: _t.PathT) -> GitWorkdir | None:
7274

7375
return cls(real_wd)
7476

75-
def do_ex_git(self, cmd: list[str]) -> _t.CmdResult:
77+
def do_ex_git(self, cmd: list[str]) -> _CmdResult:
7678
return self.do_ex(["git", "--git-dir", join(self.path, ".git")] + cmd)
7779

7880
def is_dirty(self) -> bool:
@@ -120,7 +122,7 @@ def count_all_nodes(self) -> int:
120122
revs, _, _ = self.do_ex_git(["rev-list", "HEAD"])
121123
return revs.count("\n") + 1
122124

123-
def default_describe(self) -> _t.CmdResult:
125+
def default_describe(self) -> _CmdResult:
124126
git_dir = join(self.path, ".git")
125127
return self.do_ex(
126128
DEFAULT_DESCRIBE[:1] + ["--git-dir", git_dir] + DEFAULT_DESCRIBE[1:]

0 commit comments

Comments
 (0)