You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
moonstone/vanilla_first_setup/utils/flatpak.py

39 lines
975 B
Python

import os
import subprocess
class Flatpak:
env = os.environ.copy()
@staticmethod
def install(packages: list):
proc = subprocess.Popen(
['flatpak', 'install', '--user'] + packages,
env=Flatpak.env,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
proc.communicate(input=b'y\n')
@staticmethod
def remove(packages: list):
proc = subprocess.Popen(
['flatpak', 'remove', '--user'] + packages,
env=Flatpak.env,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
proc.communicate(input=b'y\n')
@staticmethod
def add_repo(repo: str):
proc = subprocess.Popen(
['flatpak', 'remote-add', 'test', '--user', '--if-not-exists', repo],
env=Flatpak.env,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
proc.communicate(input=b'y\n')