-
Notifications
You must be signed in to change notification settings - Fork 1
/
flatpak.py
30 lines (23 loc) · 871 Bytes
/
flatpak.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, dotbot
class Flatpak(dotbot.Plugin):
_directive = 'flatpak'
def can_handle(self, directive):
return self._directive == directive
def handle(self, directive, data):
if directive != self._directive:
raise ValueError('flatpak cannot handle directive %s' %
directive)
success = True
for app in data:
try:
subprocess.run(
['flatpak install --noninteractive '+app],
shell=True,
check=True)
except subprocess.CalledProcessError:
success = False
if success:
self._log.info('All packages have been installed')
else:
self._log.error('Some packages were not successfully installed')
return success