Commit 4cea66a0 authored by Alexandru Băluț's avatar Alexandru Băluț Committed by Thibault Saunier

flatpak: Remove more non-development functionality

parent 1e2c8d0b
...@@ -388,7 +388,8 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes ...@@ -388,7 +388,8 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
finally: finally:
devnull.close() devnull.close()
def check_flatpak(self): @staticmethod
def check_flatpak():
try: try:
output = subprocess.check_output(["flatpak", "--version"]) output = subprocess.check_output(["flatpak", "--version"])
except FileNotFoundError: except FileNotFoundError:
...@@ -398,7 +399,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes ...@@ -398,7 +399,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
" how to install it for your distribution at:\n" " how to install it for your distribution at:\n"
" * http://flatpak.org/%s\n", Colors.FAIL, " * http://flatpak.org/%s\n", Colors.FAIL,
FLATPAK_REQ, sys.argv[0], Colors.ENDC) FLATPAK_REQ, sys.argv[0], Colors.ENDC)
self.exit(1) exit(1)
def comparable_version(version): def comparable_version(version):
return [int(number) for number in version.split(".")] return [int(number) for number in version.split(".")]
...@@ -408,13 +409,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes ...@@ -408,13 +409,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
Console.message("\n%sFlatpak %s required but %s found." Console.message("\n%sFlatpak %s required but %s found."
" Please update and try again%s\n", Colors.FAIL, " Please update and try again%s\n", Colors.FAIL,
FLATPAK_REQ, version, Colors.ENDC) FLATPAK_REQ, version, Colors.ENDC)
self.exit(1) exit(1)
def exit(self, exitcode):
if self.installer:
input("Failure installing %s press <enter> to continue" % self.name)
exit(exitcode)
def clean_args(self): def clean_args(self):
Console.quiet = self.quiet Console.quiet = self.quiet
...@@ -499,7 +494,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes ...@@ -499,7 +494,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
try: try:
subprocess.check_call(build_export_args) subprocess.check_call(build_export_args)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
self.exit(1) exit(1)
update_repo_args = ["flatpak", "build-update-repo"] update_repo_args = ["flatpak", "build-update-repo"]
...@@ -512,7 +507,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes ...@@ -512,7 +507,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
try: try:
subprocess.check_call(update_repo_args) subprocess.check_call(update_repo_args)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
self.exit(1) exit(1)
def setup_sandbox(self): def setup_sandbox(self):
"""Creates and updates the sandbox.""" """Creates and updates the sandbox."""
...@@ -534,7 +529,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes ...@@ -534,7 +529,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
except FileNotFoundError: except FileNotFoundError:
Console.message("\n%sYou need to install flatpak-builder%s\n", Console.message("\n%sYou need to install flatpak-builder%s\n",
Colors.FAIL, Colors.ENDC) Colors.FAIL, Colors.ENDC)
self.exit(1) exit(1)
subprocess.check_call(builder_args, cwd=self.scriptdir) subprocess.check_call(builder_args, cwd=self.scriptdir)
if not os.path.isdir("mesonbuild/"): if not os.path.isdir("mesonbuild/"):
...@@ -618,7 +613,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes ...@@ -618,7 +613,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
subprocess.check_call(flatpak_command, cwd=cwd) subprocess.check_call(flatpak_command, cwd=cwd)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
if exit_on_failure: if exit_on_failure:
self.exit(e.returncode) exit(e.returncode)
def install_flatpak_runtimes(self): def install_flatpak_runtimes(self):
for runtime in self.packs: for runtime in self.packs:
...@@ -642,9 +637,6 @@ if __name__ == "__main__": ...@@ -642,9 +637,6 @@ if __name__ == "__main__":
general.add_argument("--update", dest="update", general.add_argument("--update", dest="update",
action="store_true", action="store_true",
help="Update the runtime/sdk/app and rebuild the development environment") help="Update the runtime/sdk/app and rebuild the development environment")
general.add_argument("--installer", dest="installer",
action="store_true",
help="Wait for Enter to be pressed when the script exits because something failed")
general.add_argument("-q", "--quiet", dest="quiet", general.add_argument("-q", "--quiet", dest="quiet",
action="store_true", action="store_true",
help="Do not print anything") help="Do not print anything")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment