On Mon, 14 Sep 2009 10:13:55 -0400, Glyph Lefkowitz wrote: >> >>>> I'm a little skeptical about creating a new mini language >> (particularly one >> >>>> with branching) for setup.cfg, >> >> >> >> Me too. >> > > Me three. Even after hearing the motivating use-cases, like: > >> So you can for example define a list of dependencies that changes wether >> > you are under windows or linux, etc..
Me four. >> OK. I've never had that situation. I'm sure someone has, but it >> doesn't see common. If you follow answers and questions posted to distutils list you notice after a while that windows users get less answers to questions on distutils relatated questions. Linux a little more. I have come to conclude that "edge-cases" just means windows or to a less degree linux users. It's a distutils sort of keyword for people that don't get acknowledged as even existing. Is it distutils platform bias? I wonder.. > 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. It's true for many windows packages. > One big problem I have with this discussion is that it seems to be > approaching the whole problem backwards. Distutils projects seem to have a > history of defining new file formats rather than or before new APIs. > (PKG-INFO, MANIFEST.in, egg-info, etc etc). And also a history of being highly selective about who can be blessed to work on code. I think windows programmers have substantially reduced chances of making contributions. > 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? That's easy.... Here's a workhorse file you can get from the python package manager.. http://pythonpkgmgr.svn.sourceforge.net/viewvc/pythonpkgmgr/Packaging.py?revision=103&view=markup At the command line: C:\Documents and Settings\DL\Desktop\pythonpkgmgr>python packaging.py --metadata pygame Package Manager Test - using configuration file C:\Documents and Settings\DL\Desktop\pythonpkgmgr\py thonpkgmgr.ini - Changing to python 2.6 in C:\Python26\ - checking package Metadata is as follows: ['Metadata-Version: 1.0\n', 'Name: pywin32\n', 'Version: 214\n', 'Summary: Pytho n for Window Extensions\n', 'Home-page: http://sourceforge.net/projects/pywin32/ \n', 'Author: Mark Hammond (et al)\n', 'Author-email: mhamm...@users.sourceforge .net\n', 'License: PSF\n', 'Description: Python extensions for Microsoft Windows \n', ' Provides access to much of the Win32 API, the\n', ' ability to create and use COM objects, and the\n', ' Pythonwin environment.\n', 'Platform: UNKNOWN\n'] In code: pm = PackageManager() info = pm.package_information("pygame") print " - checking package %s" % package if "PKG-INFO" in info.keys(): print "Metadata is as follows:" print info["PKG-INFO"] else: print "No Metadata found" > The answer seems to be a bizarre combination of running setup.py, maybe > reading PKG-INFO, maybe something to do with egg-info...? Or maybe making > some direct calls with xmlrpclib? Or setuptools? Setuptools must be able > to do it internally, but I can't find an API in the documentation. You're right. Distutils can't do it at the moment. > Before trying to make the metadata static, let's try to have the metadata, > for real, at all. Here's an example of something I want to be able to do > with metadata: > > from distutils.something import ( > load_metadata, pypi_metadata, installed_metadata) > meta = installed_metadata("Twisted") > meta2 = load_metadata("/home/glyph/Downloads/Twisted-x.y") > meta3 = pypi_metadata("Twisted") > if meta2.version > meta.version: > print 'More recent version of Twisted already downloaded!' > if meta3.version > meta2.version: > print 'More recent version of Twisted is available online!' +1 > 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? Originally, we could only have conditional 'code' in programs. But now there's a push to move it out of python code and create a new mini language (that isn't python) stored within configuration files. The end result will be two languages (python and the new language) sitting in two places (setup.py and setup.cfg) able to do exactly the same thing. I think that will get confusing.. especially for us windows users... We've never been allowed to have code in configuration files.. So I am watching to see how this one pans out... David _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig