On Mon, 14 Sep 2009 07:13:55 -0700, Glyph Lefkowitz <gl...@twistedmatrix.com> wrote:

So you can for example define a list of dependencies that changes wether
> you are under windows or linux, etc..

OK. I've never had that situation. I'm sure someone has, but it
doesn't see common.


Twisted actually has this. On Windows, we need pywin32 to implement many of
the features which can be implemented with just the stdlib on Posix.  But
this is the only thing I can imagine computing based on the execution
environment.

I believe virtualenv requires pywin32. Maybe several other Python packages too.

I may be missing some context, but I did about an hour of googling around
before responding here, and for the life of me I can't find a simple answer to the question: how do I currently programatically get the metadata out of
a distribution?

http://pypi.python.org/pypi/pkginfo/

[...]  Before
adding conditional support to setup.cfg I would want to have a separate
'metadata.py' whose responsibilities were clearer: just produce the
metadata, don't do any pre-build steps. Ideally that would be easy to load
correctly from setup.py as well.

I double users would follow this proposed convention. Once in a while, I stumble upon Python packages that do not even succeed at the "python setup.py" stage.

Even if they did, what prevents them from making metadata.py a little more sophisticated so as to introduce inadvertent bugs on other platforms? (Just today, argparse's new release broke on linux and mac, but not on Windows .. due to regex parsing behavior)

I vote for static metadata anyday.

Inspecting metadata could also be made easier by having an API more like
this for setup.py:

d = Distribution(... metadata ....)
if d.installing:
    my_project.custom_prepare_for_build()
d.setup()

since you can't really tell what setup() is going to do until you've already
called it.

I doubt this would happen in practice even if widely suggested by distutils/setuptools.

So finally, if there's still no standard programmatic way to get at the
distribution metadata after setup.cfg is modified to have conditional
expressions in it, what exactly is the point?

...

Conditional metadata for Python versions does not have to be very complicated in my opinion. Simply have the following in setup.cfg, and thus in PKG-INFO:

install_requires = ['lxml', 'multiprocessing[pyver<(2,6)]', 'argparse', 'pywin32[platform.name=windows]']

metadata.get_install_requires(for_pyver=(2,6), platform=Platform(name='windows', arch='x86'))
['lxml', 'argparse', 'pywin32']

I don't imagine fields other than `install_requires` to vary based on the target environment.

Simple, no?

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

Reply via email to