[Distutils] parallelize setup.py develop/build

Andrea Crotti andrea.crotti.0 at gmail.com
Sun Dec 18 14:07:32 CET 2011

On 12/18/2011 11:35 AM, Andrea Crotti wrote:
> Since I have to run many setup.py develop/build I wanted to try to
> parallelize the calls.
> The normal setup.py is something like
> from setuptools import setup
> setup(...)
> But I was wondering, why isn't it
> from setuptools import setup
> if __name__ == '__main__':
>       setup(...)
> In this way it would be possible to import the setup file without
> actually running any code.
> What I don't really like in fact is to be forced to call an external
> subprocess call just to run
> some other python code..
> And in that way I would have more control also on the output and the
> errors that I receive,
> does it make sense?
> Going back to the original question, parallelizing many build/develop
> calls can be actually
> faster or is the same in case the hard disk is still only one?

Ok in theory is possible to import the setup code from another module,
on error however, setuptools call sys.exit, so I have to do something
like this:

if __name__ == '__main__':
    from setup import call_setup
    # try to fetch the errors produced
    except SystemExit:
        print("catched exception")
       #  do something useful

More information about the Distutils-SIG mailing list