Skip to content
Merged
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: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ In development
--------------

* #733: Do not search excluded directories for packages.
This introduced a backwards incompatible change in ``find_packages()``
so that ``find_packages(exclude=['foo']) == []``, excluding subpackages of ``foo``.
Previously, ``find_packages(exclude=['foo']) == ['foo.bar']``,
even though the parent ``foo`` package was excluded.

v27.3.0
-------
Expand Down
9 changes: 9 additions & 0 deletions setuptools/tests/test_find_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ def test_exclude(self):
packages = find_packages(self.dist_dir, exclude=('pkg.*',))
assert packages == ['pkg']

def test_exclude_recursive(self):
"""
Excluding a parent package should exclude all child packages as well.
"""
self._touch('__init__.py', self.pkg_dir)
self._touch('__init__.py', self.sub_pkg_dir)
packages = find_packages(self.dist_dir, exclude=('pkg',))
assert packages == []

def test_include_excludes_other(self):
"""
If include is specified, other packages should be excluded.
Expand Down