2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 from mozbuild
.shellutil
import quote
as shellquote
10 from vsdownload
import (
19 if __name__
== "__main__":
20 parser
= getArgsParser()
21 parser
.add_argument("-o", dest
="output", required
=True, help="Output file")
23 "--exclude", default
=[], nargs
="+", help="Patterns of file names to exclude"
25 args
= parser
.parse_args()
26 lowercaseIgnores(args
)
28 packages
= getPackages(getManifest(args
))
29 setPackageSelection(args
, packages
)
30 selected
= getSelectedPackages(packages
, args
)
32 # Filter-out data we won't be using.
35 if type == "Component" or type == "Workload" or type == "Group":
37 if type == "Vsix" or s
["id"].startswith(("Win10SDK", "Win11SDK")):
38 filtered
= {k
: v
for k
, v
in s
.items() if k
in ("type", "id", "version")}
39 filtered
["payloads"] = [
42 for k
, v
in payload
.items()
43 if k
in ("fileName", "sha256", "size", "url")
45 for payload
in s
["payloads"]
46 if payload
["fileName"].endswith((".cab", ".msi", ".vsix"))
47 and not any(e
in payload
["fileName"] for e
in args
.exclude
)
49 reduced
.append(filtered
)
50 with
open(args
.output
, "w") as out
:
51 print("# Generated with:", file=out
)
53 "# ./mach python --virtualenv build build/vs/generate_yaml.py \\", file=out
55 for i
, arg_
in enumerate(sys
.argv
[1:]):
56 arg
= shellquote(arg_
)
57 if i
< len(sys
.argv
) - 2:
58 print("# ", arg
, "\\", file=out
)
60 print("# ", arg
, file=out
)
61 print(yaml
.dump(reduced
), file=out
)