Skip to content

Commit

Permalink
More directories that cannot be traversed
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek committed Sep 18, 2022
1 parent 38f60ff commit 37b5db0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
4 changes: 1 addition & 3 deletions backend/src/hatchling/builders/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,7 @@ def default_packages(self):
return []

def default_global_exclude(self):
patterns = ['*.py[cdo]', *EXCLUDED_DIRECTORIES]
patterns.sort()
return patterns
return ['*.py[cdo]', f'/{DEFAULT_BUILD_DIRECTORY}']

def get_force_include(self):
force_include = self.force_include.copy()
Expand Down
19 changes: 18 additions & 1 deletion backend/src/hatchling/builders/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
DEFAULT_BUILD_DIRECTORY = 'dist'

EXCLUDED_DIRECTORIES = frozenset(('.git', '__pycache__'))
EXCLUDED_DIRECTORIES = frozenset(
(
# Python bytecode
'__pycache__',
# PEP 582
'__pypackages__',
# Git
'.git',
# Mercurial
'.hg',
# Hatch
'.hatch',
# tox
'.tox',
# nox
'.nox',
)
)


class BuildEnvVars:
Expand Down
4 changes: 4 additions & 0 deletions docs/history.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ This is the first stable release of Hatch v1, a complete rewrite. Enjoy!

### Unreleased

***Added:***

- Add the following to the list of directories that cannot be traversed: `__pypackages__`, `.hg`, `.hatch`, `.tox`, `.nox`

***Fixed:***

- Improve tracking of dynamic metadata
Expand Down
2 changes: 1 addition & 1 deletion tests/backend/builders/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ def test_packages(self, isolation):
def test_global_exclude(self, isolation):
builder = Builder(str(isolation))

assert builder.config.default_global_exclude() == ['*.py[cdo]', '.git', '__pycache__']
assert builder.config.default_global_exclude() == ['*.py[cdo]', '/dist']


class TestPatternInclude:
Expand Down

0 comments on commit 37b5db0

Please sign in to comment.