diff --git a/newsfragments/4789.misc.rst b/newsfragments/4789.misc.rst new file mode 100644 index 0000000000..7f8dfd6a7f --- /dev/null +++ b/newsfragments/4789.misc.rst @@ -0,0 +1 @@ +Don't emit ``Package would be ignored`` warning for explicitly included data files. diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py index e7d60c6440..7d19330cb4 100644 --- a/setuptools/command/build_py.py +++ b/setuptools/command/build_py.py @@ -194,6 +194,10 @@ def analyze_manifest(self) -> None: files = ei_cmd.filelist.files check = _IncludePackageDataAbuse() + data_files = { + package: filenames + for package, _, _, filenames in self.get_data_files_without_manifest() + } for path in self._filter_build_files(files, egg_info_dir): d, f = os.path.split(assert_relative(path)) prev = None @@ -208,7 +212,7 @@ def analyze_manifest(self) -> None: continue # it's a module, not data else: importable = check.importable_subpackage(src_dirs[d], f) - if importable: + if importable and f not in data_files.get(d, {}): check.warn(importable) self.manifest_files.setdefault(src_dirs[d], []).append(path)