minor improvements

main
mirkobrombin 2 years ago
parent 13abeb9f68
commit c912f1860c

@ -12,7 +12,9 @@ class Apt:
subprocess.run( subprocess.run(
['sudo', 'apt', 'install'] + packages + ['-y'], ['sudo', 'apt', 'install'] + packages + ['-y'],
env=Apt.env, env=Apt.env,
check=True check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
) )
@staticmethod @staticmethod
@ -20,7 +22,9 @@ class Apt:
subprocess.run( subprocess.run(
['sudo', 'apt', 'remove'] + packages + ['-y'], ['sudo', 'apt', 'remove'] + packages + ['-y'],
env=Apt.env, env=Apt.env,
check=True check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
) )
@staticmethod @staticmethod
@ -28,7 +32,9 @@ class Apt:
subprocess.run( subprocess.run(
['sudo', 'apt', 'purge'] + packages + ['-y'], ['sudo', 'apt', 'purge'] + packages + ['-y'],
env=Apt.env, env=Apt.env,
check=True check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
) )
@staticmethod @staticmethod
@ -36,7 +42,9 @@ class Apt:
subprocess.run( subprocess.run(
['sudo', 'apt', 'update'], ['sudo', 'apt', 'update'],
env=Apt.env, env=Apt.env,
check=True check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
) )
@staticmethod @staticmethod
@ -44,5 +52,7 @@ class Apt:
subprocess.run( subprocess.run(
['sudo', 'apt', 'upgrade', '-y'], ['sudo', 'apt', 'upgrade', '-y'],
env=Apt.env, env=Apt.env,
check=True check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
) )

@ -1,25 +1,36 @@
import os
import subprocess import subprocess
class Flatpak: class Flatpak:
env = os.environ.copy()
@staticmethod @staticmethod
def install(packages: list): def install(packages: list):
subprocess.run( subprocess.run(
['flatpak', 'install', '--user'] + packages, ['flatpak', 'install', '--user'] + packages,
check=True env=Flatpak.env,
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
) )
@staticmethod @staticmethod
def remove(packages: list): def remove(packages: list):
subprocess.run( subprocess.run(
['flatpak', 'remove', '--user'] + packages, ['flatpak', 'remove', '--user'] + packages,
check=True env=Flatpak.env,
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
) )
@staticmethod @staticmethod
def add_repo(repo: str): def add_repo(repo: str):
subprocess.run( subprocess.run(
['flatpak', 'remote-add', '--user', '--if-not-exists', repo], ['flatpak', 'remote-add', '--user', '--if-not-exists', repo],
check=True env=Flatpak.env,
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
) )

@ -1,18 +1,26 @@
import os
import subprocess import subprocess
class Snap: class Snap:
env = os.environ.copy()
@staticmethod @staticmethod
def install(packages: list): def install(packages: list):
subprocess.run( subprocess.run(
['snap', 'install'] + packages, ['snap', 'install'] + packages,
check=True env=Snap.env,
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
) )
@staticmethod @staticmethod
def remove(packages: list): def remove(packages: list):
subprocess.run( subprocess.run(
['snap', 'remove'] + packages, ['snap', 'remove'] + packages,
check=True env=Snap.env,
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
) )

Loading…
Cancel
Save