Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet: allow specifying the --runtime argument multiple times #386

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions dotnet/flatpak-dotnet-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument('output', help='The output JSON sources file')
parser.add_argument('project', help='The project file')
parser.add_argument('--runtime', '-r', help='The target runtime to restore packages for')
parser.add_argument('--runtime', '-r', nargs='+', default=[None], help='The target runtime to restore packages for')
parser.add_argument('--freedesktop', '-f', help='The target version of the freedesktop sdk to use',
default=freedesktop_default)
parser.add_argument('--dotnet', '-d', help='The target version of dotnet to use',
Expand All @@ -34,18 +34,19 @@ def main():
sources = []

with tempfile.TemporaryDirectory(dir=Path()) as tmp:
runtime_args = []
if args.runtime:
runtime_args.extend(('-r', args.runtime))
for runtime in args.runtime:
runtime_args = []
if runtime is not None:
runtime_args.extend(('-r', runtime))

subprocess.run([
'flatpak', 'run',
'--env=DOTNET_CLI_TELEMETRY_OPTOUT=true',
'--env=DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true',
'--command=sh', f'--runtime=org.freedesktop.Sdk//{args.freedesktop}', '--share=network',
'--filesystem=host', f'org.freedesktop.Sdk.Extension.dotnet{args.dotnet}//{args.freedesktop}', '-c',
f'PATH="${{PATH}}:/usr/lib/sdk/dotnet{args.dotnet}/bin" LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/sdk/dotnet{args.dotnet}/lib" exec dotnet restore "$@"',
'--', '--packages', tmp, args.project] + runtime_args)
subprocess.run([
'flatpak', 'run',
'--env=DOTNET_CLI_TELEMETRY_OPTOUT=true',
'--env=DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true',
'--command=sh', f'--runtime=org.freedesktop.Sdk//{args.freedesktop}', '--share=network',
'--filesystem=host', f'org.freedesktop.Sdk.Extension.dotnet{args.dotnet}//{args.freedesktop}', '-c',
f'PATH="${{PATH}}:/usr/lib/sdk/dotnet{args.dotnet}/bin" LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/sdk/dotnet{args.dotnet}/lib" exec dotnet restore "$@"',
'--', '--packages', tmp, args.project] + runtime_args)

for path in Path(tmp).glob('**/*.nupkg.sha512'):
name = path.parent.parent.name
Expand Down