From 70f21121d11009af25bef8aaf73dafd7ef7f26dc Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Mon, 2 Dec 2019 12:38:32 +0100 Subject: config: add a method to get all releases --- lib/python/config.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/python/config.py b/lib/python/config.py index 61f633ee28..c445dadb6c 100644 --- a/lib/python/config.py +++ b/lib/python/config.py @@ -15,6 +15,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# TODO: the OrderedDict use can be dropped once we use Python 3 (>= 3.7) +from collections import OrderedDict import json import os @@ -26,7 +28,7 @@ def get_config(): d = os.path.dirname(os.path.abspath(__file__)) with open(d + '/../../data/config.json') as f: - config = json.load(f) + config = json.load(f, object_pairs_hook=OrderedDict) _config = config['distributions'] @@ -37,6 +39,11 @@ def get_supported_releases(): return [d for d in config.keys() if 'release' in config[d]] +def get_all_releases(): + config = get_config() + + return config.keys() + def get_release_codename(release, suffix=''): config = get_config() -- cgit v1.2.3