diff --git a/openstack_releases/cmds/list_constraints.py b/openstack_releases/cmds/list_constraints.py new file mode 100644 index 0000000000..ba06df68f5 --- /dev/null +++ b/openstack_releases/cmds/list_constraints.py @@ -0,0 +1,51 @@ +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +"""Show the most current versions of everything in a given branch. +""" + +from __future__ import print_function + +import argparse +import glob +import os +import os.path + +import yaml + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument( + 'series', + help='the name of the release series to scan', + ) + args = parser.parse_args() + + filenames = sorted(glob.glob('deliverables/' + args.series + '/*.yaml')) + if not filenames: + print('no deliverable files found under {}'.format(args.series)) + return 1 + + for filename in filenames: + with open(filename, 'r') as f: + deliverable_info = yaml.load(f.read()) + + deliverable_name = os.path.splitext(os.path.basename(filename))[0] + + # assume the releases are in order and take the last one + new_release = deliverable_info['releases'][-1] + print('{}==={}'.format(deliverable_name, new_release['version'])) + + return 0 diff --git a/setup.cfg b/setup.cfg index 3dbcbec500..f4e1628bdc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,6 +23,7 @@ packages = openstack_releases console_scripts = validate-request = openstack_releases.cmds.validate:main list-changes = openstack_releases.cmds.list_changes:main + list-constraints = openstack_releases.cmds.list_constraints:main [extras] sphinxext =