]> git.lyx.org Git - features.git/commitdiff
Fix bug in python comparison.
authorJosé Matos <jamatos@lyx.org>
Mon, 3 Jun 2019 16:15:09 +0000 (17:15 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:32 +0000 (15:48 +0200)
It worked in python2 but not the way the authors imagined. Because hex always returns a string.

From python2:
>>> 1 > "2"
False
>>> "2" > 1
True
>>> "1" > 2
True

The rational is that an integer is always smaller than a string.

In python 3 this because it does not make sense to compare objects of different types.

lib/scripts/convertDefault.py

index 418b553758ed6d95bbdea33ede7549840c8305c2..eee533d5ea4cb7b5a96581a52d00183c169ac2d9 100644 (file)
@@ -72,7 +72,7 @@ if sys.argv[1] == 'pdf' and (version >= 0x060206 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 >= "0x060305" or gm):
     topts = '-flatten'
 
 # print (command, sys.argv[2], sys.argv[4], file= sys.stdout)