build.py 835 B

123456789101112131415161718192021222324
  1. from distutils.command.build import build as _build
  2. import warnings
  3. from setuptools import SetuptoolsDeprecationWarning
  4. _ORIGINAL_SUBCOMMANDS = {"build_py", "build_clib", "build_ext", "build_scripts"}
  5. class build(_build):
  6. # copy to avoid sharing the object with parent class
  7. sub_commands = _build.sub_commands[:]
  8. def run(self):
  9. subcommands = {cmd[0] for cmd in _build.sub_commands}
  10. if subcommands - _ORIGINAL_SUBCOMMANDS:
  11. msg = """
  12. It seems that you are using `distutils.command.build` to add
  13. new subcommands. Using `distutils` directly is considered deprecated,
  14. please use `setuptools.command.build`.
  15. """
  16. warnings.warn(msg, SetuptoolsDeprecationWarning)
  17. self.sub_commands = _build.sub_commands
  18. super().run()