-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-missing.sh
executable file
·37 lines (25 loc) · 1 KB
/
build-missing.sh
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
33
34
35
36
#! /usr/bin/python3
import os
import subprocess
import tempfile
installed = set()
available = {}
r = subprocess.run(['flatpak', 'list', '--columns=application'], stdout=subprocess.PIPE, check=True)
for name in r.stdout.decode().split('\n'):
if name.startswith('de.uchuujin.fp.termzoo.'):
installed.add(name)
for path, dirs, files in os.walk('.'):
for file in files:
if file.startswith('de.uchuujin.fp.termzoo.') and file.endswith('.json'):
available[file[:-5]] = path
installed_only = installed - available.keys()
if installed_only:
print('installed by no build manifest', sorted(installed_only))
to_build = available.keys() - installed
if to_build:
print('build manifest but not yet installed', sorted(to_build))
for name in sorted(to_build):
with tempfile.TemporaryDirectory(dir='.') as tmp:
cmd = ['flatpak-builder', '--install', '--user', tmp, available[name] + '/' + name + '.json']
print('running: ', cmd)
subprocess.run(cmd, check=True)