diff options
author | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2021-11-01 19:47:33 +0000 |
---|---|---|
committer | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2021-11-01 20:50:58 +0000 |
commit | 2e66eb7147ae1e8a799b2276c7340f48f63a7220 (patch) | |
tree | 9f828df18ed795371ac4e680672d82308e101a7d /setuptools/command/egg_info.py | |
parent | 8b37b2ba986cf4736ab46aa2f9c31d424cbfb098 (diff) | |
download | python-setuptools-git-2e66eb7147ae1e8a799b2276c7340f48f63a7220.tar.gz |
Fix 1461: Better loop breaker for `manifest_maker`
The inconsistency for the `package_data` configuration in sdists
when `include_package_data=True` in #1461 have been causing some
problems for the community for a while, as also shown in #2835.
As pointed out by
[@jaraco](https://github.com/pypa/setuptools/issues/1461#issuecomment-749092366),
this was being caused by a mechanism to break the recursion between the
`egg_info` and `sdist` commands.
In summary the loop is caused by the following behaviour:
- the `egg_info` command uses a subclass of `sdist` (`manifest_maker`)
to calculate the MANIFEST,
- the `sdist` class needs to know the MANIFEST to calculate the data files when
`include_package_data=True`
Previously, the mechanism to break this loop was to simply ignore
the data files in `sdist` when `include_package_data=True`.
The approach implemented in this change was to replace this mechanism,
by allowing `manifest_maker` to override the `_safe_data_files` method
from `sdist`.
---
Please notice [an extensive experiment]
(https://github.com/abravalheri/experiment-setuptools-package-data)
was carried out to investigate the previous confusing behaviour.
There is also [a simplified theoretical analysis]
(https://github.com/pyscaffold/pyscaffold/pull/535#issuecomment-956296407)
comparing the observed behavior in the experiment and the expected
one. This analysis point out to the same offender indicated by
[@jaraco](https://github.com/pypa/setuptools/issues/1461#issuecomment-749092366)
(which is being replaced in this change).
Diffstat (limited to 'setuptools/command/egg_info.py')
-rw-r--r-- | setuptools/command/egg_info.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 18b81340..ff009861 100644 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -608,6 +608,17 @@ class manifest_maker(sdist): self.filelist.exclude_pattern(r'(^|' + sep + r')(RCS|CVS|\.svn)' + sep, is_regex=1) + def _safe_data_files(self, build_py): + """ + The parent class implementation of this method (``sdist``) will try to + include data files, which might cause recursion problems, when + ``include_package_data=True``. + + Therefore we have to avoid triggering any attempt of analyzing/building + the manifest again. + """ + return build_py.get_data_files_without_manifest() + def write_file(filename, contents): """Create a file with the specified name and write 'contents' (a |