Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/src/hatchling/builders/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,11 +752,11 @@ def get_distribution_path(self, relative_path: str) -> str:
def vcs_exclusion_files(self) -> dict[str, list[str]]:
exclusion_files: dict[str, list[str]] = {"git": [], "hg": []}

local_gitignore = locate_file(self.root, ".gitignore", boundary=".git")
local_gitignore = locate_file(self.root, ".gitignore", boundaries=[".git", ".hg"])
if local_gitignore is not None:
exclusion_files["git"].append(local_gitignore)

local_hgignore = locate_file(self.root, ".hgignore", boundary=".hg")
local_hgignore = locate_file(self.root, ".hgignore", boundaries=[".git", ".hg"])
if local_hgignore is not None:
exclusion_files["hg"].append(local_hgignore)

Expand Down
4 changes: 2 additions & 2 deletions backend/src/hatchling/utils/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import os


def locate_file(root: str, file_name: str, *, boundary: str | None = None) -> str | None:
def locate_file(root: str, file_name: str, *, boundaries: list[str] | None = None) -> str | None:
while True:
file_path = os.path.join(root, file_name)
if os.path.isfile(file_path):
return file_path

if boundary is not None and os.path.exists(os.path.join(root, boundary)):
if boundaries is not None and any(os.path.exists(os.path.join(root, boundary)) for boundary in boundaries):
return None

new_root = os.path.dirname(root)
Expand Down