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.
19 return yaml
.safe_load(open(fname
, "r").read())
22 # If "compiler" is omitted from the included env then Travis picks the
23 # first entry of the global compiler list.
24 default_compiler
= conf
["compiler"][0]
26 return env
if isinstance(env
, list) else [env
]
27 for entry
in conf
["matrix"]["include"]:
28 yield {"env": env_to_list(entry
["env"]),
29 "compiler": entry
.get("compiler", default_compiler
)}
33 sys
.stderr
.write("Usage: %s <travis-file>\n" % sys
.argv
[0])
35 conf
= load_yaml(sys
.argv
[1])
36 print("\n".join((": ${%s}" % var
for var
in conf
["env"]["global"])))
37 for config
in conf_iter(conf
):
39 print("\n".join(config
["env"]))
40 print("alias cc=" + config
["compiler"])
41 print("\n".join(conf
["before_script"]))
42 print("\n".join(conf
["script"]))
46 if __name__
== "__main__":