releases/openstack_releases/cmds/list_constraints.py
Doug Hellmann 2e6b80df71 add list-constraints command
list-constraints takes a series name as input and produces a constraints
file including all of the packages released as part of that series. It
doesn't differentiate between servers and libraries and tools, since we
don't know from here which might be listed in a given constraints
file. Merging the output with a real constraints file is the
responsibility of the user.

Change-Id: I6f669dca320825f7a313953f8d13f5daf5e51368
2016-01-07 16:51:52 +00:00

52 lines
1.5 KiB
Python

# 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