astrofrog astrofrog - 3 months ago 15
Python Question

Hook to add commands to distutils build?

I've added a custom distutils command to a script:

from distutils.command.build_py import build_py

cmdclass = {}
cmdclass['build_qt'] = BuildQt
cmdclass['build_py'] = build_py

setup(..., cmdclass=cmdclass, ...)

Is there a way to make it so that when running::

python build

this first calls

python build_qt



You can override build:

from import build

class my_build(build):
    def run(self):

cmdclass['build'] = my_build