[Distutils] setup.cfg new format proposal

David Lyon david.lyon at preisshare.net
Wed Sep 16 03:39:05 CEST 2009


On Wed, 16 Sep 2009 00:42:24 -0000, exarkun at twistedmatrix.com wrote:

> I don't think it's really this simple.  

If it isn't, then it should be made to be that simple...

> The point is to have static definition of the package information.  

It would be a huge win for everybody if we could get over this
hurdle.

> Having a Python program define this information at runtime does not 
> satisfy this requirement.  

I agree with that. That's why I suggested it in the first place.

> You can 
> say that the simple sys.platform test is not evil, but how does that 
> lead to a solution allowing PyPI to tell users what the dependencies for 
> a package are on their platform?

I've been ardently campaigning for the static metadata to include
platform specific package definition for a number of months. I'll
just assume you missed my posts.

Here I'll just redescribe a typical win32/linux situation. On
win32 the odbc is built in, but you need win32com to access
it. On Linux, you don't have odbc so you need pyodbc.

"""
[setup]
name = myframework
version = 1.1

[dependencies]
packages = cherrypy, 1.1
    objectmapper, 1.5

[dependencies win32]
packages = win32com

[dependencies linux2]
packages = pyodbc

"""

It is really very simple.

> Still, it may be that if the only use case here is conditionally 
> declaring a dependency if the install target is Windows, a simpler 
> solution might suffice.  I won't try to describe such a solution. 
> Instead, I'll ask if that premise seems valid.

Yes. The premise is true for both windows and linux. They're similar
but different.

> What use cases do we have?  There's the one described above, which lots 
> of people have been talking about.  I think there's another one related 
> to target Python version - eg, on Python 2.3, depend on simplejson, but 
> on Python 2.6, don't.  What else?

Ok. Not what else, here's the complete list:

 1) Additional packages on old python versions . eg need lxml if
    xml support isn't available. simplejson.

 2) Additional packages due to o/s ommission. eg win32com on
    on windows and pyodbc on linux.

They are the typical use cases. 

It's either one or two lines in a config file or one or two lines
in the setup.py script.. 

So it is either

1) """
[dependencies linux2]
packages = pyodbc
"""

or..

2) """
    if setup.platform == "linux2":
        setup.dependencies.append('pyodbc')
"""

Anyway, the real issue here is philosophy. Eliminating
platform specifics vs making it simple for real world
use cases.

I'm also pretending that I didn't look in distutils code
and see how many "darwin" references there actually
are. But it isn't about that.. just being able to
conditionally install extra packages as required based
on whichever of the three major o/s the user happened to
choose.

David










More information about the Distutils-SIG mailing list