I'm creating a setup.py with easyinstall and I need to execute a certain py file in the same project before the build is done. I tried setup_requires and ext_modules, but both seem not to be able to call a python file in the same project.
The following code creates a new build command that calls your own custom function before delegating to the original build command. In the following, RunYourOtherScript()
stands for whatever you want to run before the build
takes place. This could be a call to execfile('src/something.py')
or preferably a relative import and a 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,
},
)