[Distutils] how do I add some functionality to my setup.py which is testable and modular?

P.J. Eby pje at telecommunity.com
Mon Aug 17 02:17:11 CEST 2009


At 02:16 PM 8/16/2009 -0600, Zooko Wilcox-O'Hearn wrote:
>So it appears to me that none of these techniques are both modular/ 
>testable and compatible with distutils/setuptools/Distribute.  What
>are we to do?

We could be modular if there was a way to specify pre-setup.py 
dependencies.  Unfortunately, there isn't such a thing at the moment, 
short of calling setup() twice, and forcing the first call to have no 
script arguments, just a setup_requires argument.

Of course, that'd only work if setuptools were present, and it would 
also force an immediate download of the build dependencies in 
question.  Something like:

   try:
       from setuptools import Distribution
   except ImportError:
       pass
   else:
       Distribution(dict(setup_requires=[...]))

If you want to get fancy, you could replace the "pass" with printing 
some user-readable instructions after attempting to see if your 
build-time dependencies are already present.



More information about the Distutils-SIG mailing list