When someone invokes the build operation via the build_meta (via https://github.com/pypa/setuptools/blob/master/setuptools/build_meta.py#L170 - https://www.python.org/dev/peps/pep-0517/#build-sdist) the setup.py is no longer automatically packaged.
In case of python setup.py sdist what ensured that this will happen is https://github.com/python/cpython/blob/master/Lib/distutils/command/sdist.py#L250. Here distribution.script_name is set to setup.py when called via python setup.py sdist. This is not set though when calling it directly via build_meta so packaging setup.py is safely ignored.
Note the files to package is determined while running egg_info, and this is re-used across runs (by reading SOURCES.txt). Therefore this bug is hidden when:
- anyone beforehand calls
python setup.py sdist,
- when there's a distutils extension that automatically pulls in setup.py (such as setuptools-scm),
- when some config value pulls in (one in
MANIFEST.in, setup.cfg, setup.py).
When someone invokes the build operation via the
build_meta(via https://github.com/pypa/setuptools/blob/master/setuptools/build_meta.py#L170 - https://www.python.org/dev/peps/pep-0517/#build-sdist) thesetup.pyis no longer automatically packaged.In case of
python setup.py sdistwhat ensured that this will happen is https://github.com/python/cpython/blob/master/Lib/distutils/command/sdist.py#L250. Heredistribution.script_nameis set tosetup.pywhen called viapython setup.py sdist. This is not set though when calling it directly viabuild_metaso packagingsetup.pyis safely ignored.Note the files to package is determined while running
egg_info, and this is re-used across runs (by readingSOURCES.txt). Therefore this bug is hidden when:python setup.py sdist,MANIFEST.in,setup.cfg,setup.py).