commit 639b5da1afe87ffe2fa4df3f738b838d6637f11a
Author: José Matos <[email protected]>
Date: Mon Jun 3 19:07:20 2019 +0100
Fix the remaing issues with comparisons with objects of different types.
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 | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/scripts/convertDefault.py b/lib/scripts/convertDefault.py
index eee533d..cd69709 100644
--- a/lib/scripts/convertDefault.py
+++ b/lib/scripts/convertDefault.py
@@ -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)