wiki.brainux.org/tools/package_list.py

27 lines
800 B
Python
Raw Normal View History

2022-05-21 23:21:24 +09:00
import requests
2022-05-22 00:46:39 +09:00
res = requests.get(
'https://raw.githubusercontent.com/brain-hackers/buildbrain/master/os-brainux/setup_brainux.sh'
)
2022-05-21 23:21:24 +09:00
lines = res.text.split('\n')
found_packages = []
backslashed = False
2022-05-22 00:46:39 +09:00
for (i, line) in enumerate(lines):
2022-05-21 23:21:24 +09:00
if line.strip().startswith('apt install') or backslashed:
if backslashed:
packages = line.strip().split(' ')
else:
packages = line.strip().split(' ')[2:]
packages = [p for p in packages if not p.startswith('-')]
packages = [p for p in packages if not p == '\\']
packages = [p.rstrip('\\') for p in packages]
found_packages.extend(packages)
backslashed = line.endswith('\\')
print('|パッケージ名|')
print('|:-|')
2022-05-22 00:46:39 +09:00
print('\n'.join(f'|{p}|' for p in found_packages))