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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to