How to programatically run python setup script?

  distutils, installation, python, setuptools

I am trying to run python a setup build/install script programmatically (in this case the Python-Matlab engine), that is run the following

python setup.py build --build-base="C:temp"

equivalently from a python program. I’ve come up with the following which does not work (as the setup seems to try to install in the setup script directory

from setuptools import sandbox
setup_script = "C:MATLABexternenginespythonsetup.py"
sandbox.run_setup(setup_script, ['build','--build-base="C:temp"'])

Is this kind of the right approach (with setuptools)? (Also I can’t make a os.system python call since I eventually want to build and run it from a single executable)

Source: Python Questions

LEAVE A COMMENT