astrofrog astrofrog - 1 year ago 106
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


Answer Source

You can override build:

from import build

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

cmdclass['build'] = my_build
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download