]> git.lyx.org Git - features.git/commitdiff
Fix the remaing issues with comparisons with objects of different types.
authorJosé Matos <jamatos@lyx.org>
Mon, 3 Jun 2019 18:07:20 +0000 (19:07 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:32 +0000 (15:48 +0200)
In python it is possible to compare tuples with a lexicographic order.

Take advantage of that since there is no need to resort to the C-trick of converting a version in hex format.

We need to set a dummy version in case we are using ImageMagick to ensure that version is always an integer 3-tuple.

lib/scripts/convertDefault.py

index eee533d5ea4cb7b5a96581a52d00183c169ac2d9..cd69709a64c2678dcf95573f757dfb39991843f3 100644 (file)
@@ -50,7 +50,7 @@ if version != None:
     major = int(version.group(1))
     minor = int(version.group(2))
     patch = int(version.group(3))
-    version = hex(major * 65536 + minor * 256 + patch)
+    version = (major, minor, patch)
     im = True
 else:
     # Try GraphicsMagick
@@ -58,6 +58,8 @@ else:
     version = re_version.match(output)
     if version != None:
         gm = True
+        # we need version to be a valid integer 3-tuple
+        version = (1,0,0)
 
 # IM >= 5.5.8 separates options for source and target files
 # See http://www.imagemagick.org/Usage/basics/#why
@@ -68,11 +70,11 @@ elif sys.platform == 'darwin':
     command = 'lyxconvert'
 
 # If supported, add the -define option for pdf source formats
-if sys.argv[1] == 'pdf' and (version >= 0x060206 or gm):
+if sys.argv[1] == 'pdf' and (version >= (6,2,6) or gm):
     sopts = '-define pdf:use-cropbox=true ' + sopts
 
 # If supported, add the -flatten option for ppm target formats (see bug 4749)
-if sys.argv[3] == 'ppm' and (im and version >= "0x060305" or gm):
+if sys.argv[3] == 'ppm' and (im and version >= (6,3,5) or gm):
     topts = '-flatten'
 
 # print (command, sys.argv[2], sys.argv[4], file= sys.stdout)