summaryrefslogtreecommitdiff
path: root/setuptools/command/build.py
blob: 932de47214c375b7ef5e69901530db0bcf45b347 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from distutils.command.build import build as _build
import warnings

from setuptools import SetuptoolsDeprecationWarning


_ORIGINAL_SUBCOMMANDS = {"build_py", "build_clib", "build_ext", "build_scripts"}


class build(_build):
    # copy to avoid sharing the object with parent class
    sub_commands = _build.sub_commands[:]

    def run(self):
        subcommands = {cmd[0] for cmd in _build.sub_commands}
        if subcommands - _ORIGINAL_SUBCOMMANDS:
            msg = """
            It seems that you are using `distutils.command.build.build` to add
            new subcommands. Using `distutils` directly is considered deprecated,
            please use `setuptools.command.build`.
            """
            warnings.warns(msg, SetuptoolsDeprecationWarning)
            self.sub_commands = _build.sub_commands
        super().run()