def _patch_prebuild(cls):
    """Patch a setuptools command to depend on `prebuild`"""
    orig_run = cls.run

    def new_run(self):
        self.run_command("prebuild")
        orig_run(self)

    cls.run = new_run
Patch a setuptools command to depend on `prebuild`