forked from gramineproject/gramine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gramine-gen-depend
executable file
·32 lines (25 loc) · 1.13 KB
/
gramine-gen-depend
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-3.0-or-later
# Copyright (c) 2021 Intel Corporation
# Borys Popławski <[email protected]>
import os
import click
from graminelibos import Manifest, _CONFIG_PKGLIBDIR
@click.command()
@click.option('--manifest', '-m', 'manifest_file', type=click.File('r', encoding='utf-8'),
required=True, help='Input .manifest file')
@click.option('--libpal', '-l', type=click.Path(exists=True, dir_okay=False),
default=os.path.join(_CONFIG_PKGLIBDIR, 'sgx/libpal.so'), help='Input libpal file',
show_default=True)
@click.option('--output', '-o', type=click.File('w', encoding='utf-8'), required=True,
help='Output .manifest.d file')
def main(manifest_file, libpal, output):
manifest = Manifest.load(manifest_file)
dependencies = manifest.get_dependencies()
dependencies.add(libpal)
output.write(f'{manifest_file.name}.sgx:')
for filename in dependencies:
output.write(f' \\\n\t{filename}')
output.write('\n')
if __name__ == '__main__':
main() # pylint: disable=no-value-for-parameter