[pitivi] build: Fix Flatpack minimum version check



commit dabab73f137a3206af2a6ab8600e30ae0291b38a
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Thu Sep 15 13:59:38 2016 +0200

    build: Fix Flatpack minimum version check
    
    0.6.4 was detected larger than 0.6.10

 build/flatpak/pitivi-flatpak |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/build/flatpak/pitivi-flatpak b/build/flatpak/pitivi-flatpak
index 03f6314..d3e78d9 100755
--- a/build/flatpak/pitivi-flatpak
+++ b/build/flatpak/pitivi-flatpak
@@ -347,14 +347,7 @@ class PitiviFlatpak:  # pylint: disable=too-many-instance-attributes
 
     def check_flatpak(self):
         try:
-            version = subprocess.check_output(
-                ["flatpak", "--version"]).decode("utf-8").split(
-                    " ")[1].strip("\n")
-
-            if version < FLATPAK_REQ:
-                message("\n%sFlatpak %s required %s found. Please update and try again%s\n", Colors.FAIL,
-                        FLATPAK_REQ, version, Colors.ENDC)
-                self.exit(1)
+            output = subprocess.check_output(["flatpak", "--version"])
         except FileNotFoundError:
             message("\n%sYou need to install flatpak >= %s"
                     " to be able to use the '%s' script.\n\n"
@@ -364,6 +357,16 @@ class PitiviFlatpak:  # pylint: disable=too-many-instance-attributes
                     FLATPAK_REQ, sys.argv[0], Colors.ENDC)
             self.exit(1)
 
+        def comparable_version(version):
+            return [int(number) for number in version.split(".")]
+
+        version = output.decode("utf-8").split(" ")[1].strip("\n")
+        if comparable_version(version) < comparable_version(FLATPAK_REQ):
+            message("\n%sFlatpak %s required but %s found."
+                    " Please update and try again%s\n", Colors.FAIL,
+                    FLATPAK_REQ, version, Colors.ENDC)
+            self.exit(1)
+
     def exit(self, exitcode):
         if self.installer:
             input("Failure installing %s press <enter> to continue" % self.name)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]