]> Git Repo - qemu.git/blame - tests/docker/travis.py
docker: use better regex to generate deb-src entries
[qemu.git] / tests / docker / travis.py
CommitLineData
d5bd7891
FZ
1#!/usr/bin/env python
2#
3# Travis YAML config parser
4#
5# Copyright (c) 2016 Red Hat Inc.
6#
7# Authors:
8# Fam Zheng <[email protected]>
9#
10# This work is licensed under the terms of the GNU GPL, version 2
11# or (at your option) any later version. See the COPYING file in
12# the top-level directory.
13
14import sys
15import yaml
16import itertools
17
18def load_yaml(fname):
19 return yaml.load(open(fname, "r").read())
20
21def conf_iter(conf):
22 def env_to_list(env):
23 return env if isinstance(env, list) else [env]
24 global_env = conf["env"]["global"]
25 for entry in conf["matrix"]["include"]:
26 yield {"env": global_env + env_to_list(entry["env"]),
27 "compiler": entry["compiler"]}
28 for entry in itertools.product(conf["compiler"],
29 conf["env"]["matrix"]):
30 yield {"env": global_env + env_to_list(entry[1]),
31 "compiler": entry[0]}
32
33def main():
34 if len(sys.argv) < 2:
35 sys.stderr.write("Usage: %s <travis-file>\n" % sys.argv[0])
36 return 1
37 conf = load_yaml(sys.argv[1])
38 for config in conf_iter(conf):
39 print "("
40 print "\n".join(config["env"])
41 print "alias cc=" + config["compiler"]
42 print "\n".join(conf["before_script"])
43 print "\n".join(conf["script"])
44 print ")"
45 return 0
46
47if __name__ == "__main__":
48 sys.exit(main())
This page took 0.066461 seconds and 4 git commands to generate.