Skip to content

Commit

Permalink
Handle custom build_py inheriting from distutils
Browse files Browse the repository at this point in the history
According to #2849, some projects, including important data-science
packages rely on `distutils` when creating custom commands, instead of
extending the ones provided by setuptools.

This change should accomodate this use case, while also warning the
users to migrate.
  • Loading branch information
abravalheri committed Nov 4, 2021
1 parent a571672 commit 08235e8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion setuptools/command/egg_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,15 @@ def _safe_data_files(self, build_py):
Therefore, avoid triggering any attempt of
analyzing/building the manifest again.
"""
return build_py.get_data_files_without_manifest()
if hasattr(build_py, 'get_data_files_without_manifest'):
return build_py.get_data_files_without_manifest()

log.warn(
"Custom 'build_py' does not implement "
"'get_data_files_without_manifest'.\nPlease extend command classes"
" from setuptools instead of distutils."
)
return build_py.get_data_files()


def write_file(filename, contents):
Expand Down

0 comments on commit 08235e8

Please sign in to comment.