[Distutils] Static metadata using setup.cfg

Ronald Oussoren ronaldoussoren at mac.com
Tue Aug 18 09:48:58 CEST 2009


On 18 Aug, 2009, at 9:08, Floris Bruynooghe wrote:

> On Tue, Aug 18, 2009 at 05:11:28AM +0300, Alex Grönholm wrote:
>> How would you declare dependencies? Remember that the list of
>> dependencies depends on at least two variables: Python version and
>> platform.
>
> Many more, defining a known list of variables to be used to define
> dependencies is not going to be enough.  Maybe there should be a way
> of having general purpose named conditionals and implement a mapping
> so that setup.py can define boolean functions for each named
> conditional.  This can then be used for modules etc too instead of
> just dependencies.
>
> The benefit is that you allow developers to specify anything possible,
> but still allow package management systems to analyse the
> dependencies and modules etc from static data.  They will recognise
> that something is conditional but are free to do with that knowledge
> they want.
>
> Expressiong conditionals in an elegant-ConfigParser-compatible way
> might be tricky.

Wouldn't it be good enough to just have the most common use-cases in  
setup.cfg? The user can still add code to setup.py to tweak the  
default behaviour when the project does something non-standard.

BTW. One way to do conditionals in ConfigParser files might be:

[dependencies.os9]
use-when:   python>=2.7, platform=='macos9'
require:   unix-toolbox>=2.5

[dependencies.suse]
use-when: file_exists('/etc/SuSE-release')
require: ...

That is, use a config-key in dependency blocks that describes when the  
block should be used. The bit after the '.' in de section-name would  
be ignored by distutils and would basicly be comment.

Ronald

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2224 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20090818/4d595088/attachment.bin>


More information about the Distutils-SIG mailing list