[Distutils] PEP-426 environment markers [was: Re: Support for condition to include or exclude a buildout sections based on a Python expression]

Daniel Holth dholth at gmail.com
Wed Jan 30 16:13:40 CET 2013


On Wed, Jan 30, 2013 at 9:58 AM, Jim Fulton <jim at zope.com> wrote:

> On Wed, Jan 30, 2013 at 9:46 AM, Daniel Holth <dholth at gmail.com> wrote:
> > My markerlib implements the PEP. https://bitbucket.org/dholth/markerlib
> >
> > The parsing is simpler than you might expect. There is no monkey
> patching.
> >
> > It is a (non-API) part of distribute since about last August.
>
> But we're not implementing the PEP. The PEP is only tangentially
> related to this use case.  I'd be happy to be PEP informed, but not if
> it makes things awkward.
>
> It's much easier to say "these are python expressions with the
> following variables available" than to say "you can use the
> expressions described in PEP 426 plus additional variables", where,
> BTW, you can't say ``not windows``, which is probably one of the 2
> most common expressions you'd want to use.  Note that many or most
> buildout users would have no reason to be familiar with the PEP.
>
> This isn't a criticism of the PEP. The PEP was developed for
> some use case that's different than this one.  Well, I'm guessing
> because the PEP doesn't actually state the problems it's addressing.
>

The PEP is a little weird, especially the inconsistent _ versus .
separators. Markerlib is a little more permissive than the spec.

Variable names can contain . when you are using eval().

The ast module is really cool. It can be used to implement powerful limited
evaluation with very little code (but only in Python 2.6+).

Happy building.

Daniel Holth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20130130/23c6b5e7/attachment-0001.html>


More information about the Distutils-SIG mailing list