-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathcheck_compat.py
30 lines (24 loc) · 1.06 KB
/
check_compat.py
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
import subprocess
from pathlib import Path
from repogen import pkg_info
from repogen.pkg_info import PackageInfo
def check(info_file: Path, package_file: Path):
info: PackageInfo = pkg_info.from_package_info_file(info_file)
compat_check_args = ['--format', 'markdown', '--details']
if 'requirements' in info:
if 'webosRelease' in info['requirements']:
compat_check_args.extend(['--fw-releases', info["requirements"]["webosRelease"]])
p = subprocess.run(args=['webosbrew-ipk-verify', *compat_check_args, str(package_file.absolute())],
shell=False, stdout=subprocess.PIPE, universal_newlines=True)
for line in p.stdout.splitlines():
if line.startswith('## Package'):
continue
print(line)
exit(p.returncode)
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--info', required=True)
parser.add_argument('-p', '--package', required=True)
args = parser.parse_args()
check(Path(args.info), Path(args.package))