diff --git a/setuptools/command/py36compat.py b/setuptools/command/py36compat.py index c256bfb855..61063e7542 100644 --- a/setuptools/command/py36compat.py +++ b/setuptools/command/py36compat.py @@ -76,7 +76,7 @@ def _add_defaults_standards(self): self.warn("standard file '%s' not found" % fn) def _add_defaults_optional(self): - optional = ['test/test*.py', 'setup.cfg', 'pyproject.toml'] + optional = ['test/test*.py', 'setup.cfg'] for pattern in optional: files = filter(os.path.isfile, glob(pattern)) self.filelist.extend(files) diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index bcfae4d82f..40965a678c 100644 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -121,6 +121,14 @@ def __read_template_hack(self): if has_leaky_handle: read_template = __read_template_hack + def _add_defaults_optional(self): + if six.PY2: + sdist_add_defaults._add_defaults_optional(self) + else: + super()._add_defaults_optional() + if os.path.isfile('pyproject.toml'): + self.filelist.append('pyproject.toml') + def _add_defaults_python(self): """getting python files""" if self.distribution.has_pure_modules():