On Sun, Jun 23, 2013 at 1:52 PM, Vinay Sajip <vinay_sa...@yahoo.co.uk> wrote: > Nick Coghlan <ncoghlan <at> gmail.com> writes: > >> * References wheel and warehouse from legacy metadata appendix > > It may also be worth mentioning that: > > * distlib supports converting legacy metadata to the new format; it's as > simple as: > > from distlib.metadata import Metadata > metadata = Metadata(path='PKG-INFO') > metadata.write(path='pymeta.json') > > * Metadata extracted from setup.py, which includes full dependency > information, is available through distlib's locate function. This > includes setuptools' newest format for extras, which has support for > for environment markers. For example: > > from distlib.locators import locate > dist = locate('setuptools') > dist.metadata.write('pymeta.json') > > Then pymeta.json contains (some fields omitted for brevity, but the > dependency stuff is there): > > { > "version": "0.7.4", > "name": "setuptools", > "metadata_version": "2.0", > "run_may_require": [ > { > "environment": "sys_platform=='win32'", > "dependencies": [ > "wincertstore (== 0.1)" > ], > "extra": "ssl" > }, > { > "environment": "sys_platform=='win32' and python_version=='2.4'", > "dependencies": [ > "ctypes (== 1.0.2)" > ], > "extra": "ssl" > }, > { > "dependencies": [ > "certifi (== 0.0.8)" > ], > "extra": "certs" > }, > { > "environment": "python_version in '2.4, 2.5'", > "dependencies": [ > "ssl (== 1.16)" > ], > "extra": "ssl" > } > ], > "extras": [ > "certs", > "ssl" > ], > } > > I would welcome feedback from anyone who cares to clone/sync the distlib > repository. A release of distlib with this functionality will occur once > incorporation of the latest spec changes occurs, and I'm comfortable that > distlib is reasonably stable following these changes. Additional testing by > others can speed up getting to that point :-) > > Regards, > > Vinay Sajip
Here is the setuptools extras+conditionals format. It just separates them with a colon: extras_require = { "ssl:sys_platform=='win32'": "wincertstore==0.1", "ssl:sys_platform=='win32' and python_version=='2.4'": "ctypes==1.0.2", "ssl:python_version in '2.4, 2.5'":"ssl==1.16", "certs": "certifi==0.0.8", }, _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig