Skip to content

Commit 3fc0620

Browse files
authored
nuget: add flag to inject only-arches data into generated files
1 parent fdbe66a commit 3fc0620

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

dotnet/flatpak-dotnet-generator.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ def main() -> None:
4545
help="The directory the generated sources file will save sources to",
4646
default="nuget-sources",
4747
)
48+
parser.add_argument(
49+
"--only-arches", help="Limit the source to this Flatpak arch", default=None
50+
)
4851
parser.add_argument(
4952
"--dotnet-args",
5053
"-a",
@@ -103,15 +106,18 @@ def restore_project(project: str, runtime: str | None) -> None:
103106
with path.open() as fp:
104107
sha512 = binascii.hexlify(base64.b64decode(fp.read())).decode("ascii")
105108

106-
sources.append(
107-
{
108-
"type": "file",
109-
"url": url,
110-
"sha512": sha512,
111-
"dest": args.destdir,
112-
"dest-filename": filename,
113-
}
114-
)
109+
data = {
110+
"type": "file",
111+
"url": url,
112+
"sha512": sha512,
113+
"dest": args.destdir,
114+
"dest-filename": filename,
115+
}
116+
117+
if args.only_arches is not None:
118+
data["only-arches"] = [args.only_arches]
119+
120+
sources.append(data)
115121

116122
with open(args.output, "w", encoding="utf-8") as fp:
117123
json.dump(sorted(sources, key=lambda n: n.get("dest-filename")), fp, indent=4)

0 commit comments

Comments
 (0)