The following code creates a new build command that calls your own custom function before passing it to the original build command. RunYourOtherScript() forward RunYourOtherScript() means you want to run before build happens. This can be an execfile('src/something.py') call execfile('src/something.py') or preferably a relative import and function call.
from distutils.command import build as build_module class build(build_module.build): def run(self): RunYourOtherScript() build_module.build.run(self) setup( ... cmdclass = { 'build': build, }, )
source share