Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Outputs a constraints.txt compatible pinning from a Plone versions.cfg. Requires zc.buildout for parsing the .cfg files, naturally.
from pkg_resources import parse_version
from zc.buildout.buildout import Buildout
def get_buildout(version):
versions_url = 'http://dist.plone.org/release/{version}/versions.cfg'
url = versions_url.format(version=version)
buildout = Buildout(
config_file=url,
cloptions=[('buildout', 'directory', '/tmp')],
user_defaults=False,
)
return buildout
def get_versions(buildout):
for version in buildout['versions'].items():
yield '=='.join(version)
if __name__ == '__main__':
import sys
try:
version = sys.argv[1]
except:
version = '5-latest'
buildout = get_buildout(version)
print '\n'.join(get_versions(buildout))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.