Skip to content

Commit

Permalink
Tidy up some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
twm committed Jul 27, 2024
1 parent 4adf23b commit 0f7001c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/incremental/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ def _get_setuptools_version(dist): # type: (_Distribution) -> None
but this hook is always called before setuptools loads anything
from ``pyproject.toml``.
"""
# When operating in a packaging context (i.e. building an sdist or wheel)
# pyproject.toml will always be found in the current working directory.
config = _load_pyproject_toml("./pyproject.toml", opt_in=False)
if not config or not config.opt_in:
return
Expand Down Expand Up @@ -487,8 +489,10 @@ def _load_pyproject_toml(toml_path, opt_in): # type: (str, bool) -> Optional[_I
affirmatively requested?
Otherwise we do our best to *never* raise an exception until we
find a ``[tool.incremental]`` opt-in. This is useful in a setuptools
context because
find a ``[tool.incremental]`` opt-in. This is important when
operating within a setuptools entry point because those hooks
are invoked anytime the L{Distribution} class is initialized,
which happens in non-packaging contexts that don't match the
"""
try:
with open(toml_path, "rb") as f:
Expand All @@ -500,8 +504,7 @@ def _load_pyproject_toml(toml_path, opt_in): # type: (str, bool) -> Optional[_I

tool_incremental = _extract_tool_incremental(data, opt_in)

# Do we have an affirmative opt-in to use Incremental? Otherwise
# we must *never* raise exceptions.
# Do we have an affirmative opt-in to use Incremental?
opt_in = opt_in or tool_incremental is not None
if not opt_in:
return None
Expand Down

0 comments on commit 0f7001c

Please sign in to comment.