Skip to content

Instantly share code, notes, and snippets.

@jaroel
Created April 4, 2016 20:02
Show Gist options
  • Save jaroel/d7f57b0884ab1eb3007cdd787fd388a2 to your computer and use it in GitHub Desktop.
Save jaroel/d7f57b0884ab1eb3007cdd787fd388a2 to your computer and use it in GitHub Desktop.
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