From: José Matos Date: Mon, 3 Jun 2019 18:07:20 +0000 (+0100) Subject: Fix the remaing issues with comparisons with objects of different types. X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=4c2334a6025d7f717c968158c3c83b212d82a752;p=features.git 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. --- diff --git a/lib/scripts/convertDefault.py b/lib/scripts/convertDefault.py index eee533d5ea..cd69709a64 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)