Re: [Distutils] from distutils.core import DistutilsOptionError

At 06:05 PM 2/23/2010 -0500, Tarek Ziadé wrote:
Or do you mean that you consider the exception classes located in Distutils to be a common need for people that write setup.py scripts ?
A setup script may want to explicitly throw (or catch) distutils errors, and having only one place to import these things from makes distutils easier to use. I don't consider it a *common* need, but I do consider it part of distutils' "core API", in the sense that if your code is either invoking distutils or being invoked by it, you may need to throw or catch those errors.
In general, everything that's a *distutils-defined* symbol (not types, os, etc.) in distutils.core, I thought was intended to be imported from there, as they are all things that could be considered part of the "core API". (And apparently, at least Thomas thought the same thing.)
(If I'd been writing distutils, I'd have named the module distutils.api rather than distutils.core, and explicitly created an __all__ list for it, but it's pretty much the same thing.)

On Tue, Feb 23, 2010 at 8:28 PM, P.J. Eby pje@telecommunity.com wrote:
At 06:05 PM 2/23/2010 -0500, Tarek Ziadé wrote:
Or do you mean that you consider the exception classes located in Distutils to be a common need for people that write setup.py scripts ?
A setup script may want to explicitly throw (or catch) distutils errors, and having only one place to import these things from makes distutils easier to use. I don't consider it a *common* need, but I do consider it part of distutils' "core API", in the sense that if your code is either invoking distutils or being invoked by it, you may need to throw or catch those errors.
In general, everything that's a *distutils-defined* symbol (not types, os, etc.) in distutils.core, I thought was intended to be imported from there, as they are all things that could be considered part of the "core API". (And apparently, at least Thomas thought the same thing.) (If I'd been writing distutils, I'd have named the module distutils.api rather than distutils.core, and explicitly created an __all__ list for it, but it's pretty much the same thing.)
Ok. I don't think this was the intent, (and from googling, it looks like most ppl are using distutils.errors), but you are right : __all__ should have been used here in the first place.
I will follow your advice in distutils2, and probably make the call as simple as setuptools':
from distutils2 import setup
(if we keep setup.py which is not sure at all)
Regards, Tarek
participants (2)
-
P.J. Eby
-
Tarek Ziadé