diff options
author | Emilio Pozuelo Monfort <pochu@debian.org> | 2019-12-02 12:38:32 +0100 |
---|---|---|
committer | Emilio Pozuelo Monfort <pochu@debian.org> | 2020-02-26 12:31:30 +0100 |
commit | 70f21121d11009af25bef8aaf73dafd7ef7f26dc (patch) | |
tree | d2cef86bdde9a11e6529f5d3394f92388bc34399 /lib | |
parent | b121f8f768017710bb62e7fca59478cde81ea8e8 (diff) |
config: add a method to get all releases
Diffstat (limited to 'lib')
-rw-r--r-- | lib/python/config.py | 9 |
1 files changed, 8 insertions, 1 deletions
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() |