3 # Travis YAML config parser
5 # Copyright (c) 2016 Red Hat Inc.
8 # Fam Zheng <famz@redhat.com>
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.
14 from __future__
import print_function
20 return yaml
.load(open(fname
, "r").read())
24 return env
if isinstance(env
, list) else [env
]
25 for entry
in conf
["matrix"]["include"]:
26 yield {"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": env_to_list(entry
[1]),
35 sys
.stderr
.write("Usage: %s <travis-file>\n" % sys
.argv
[0])
37 conf
= load_yaml(sys
.argv
[1])
38 print("\n".join((": ${%s}" % var
for var
in conf
["env"]["global"])))
39 for config
in conf_iter(conf
):
41 print("\n".join(config
["env"]))
42 print("alias cc=" + config
["compiler"])
43 print("\n".join(conf
["before_script"]))
44 print("\n".join(conf
["script"]))
48 if __name__
== "__main__":