fix python version comparison
authorarvidn <arvid@libtorrent.org>
Mon, 6 Dec 2021 21:22:47 +0000 (22:22 +0100)
committerSergio Durigan Junior <sergiodj@debian.org>
Tue, 7 Dec 2021 21:57:32 +0000 (21:57 +0000)
Origin: upstream, https://github.com/arvidn/libtorrent/commit/af60b20d44f5ec465bcd5b50d2a79a5ee5ae6ffb
Bug: https://github.com/arvidn/libtorrent/issues/6584
Reviewed-By: Sergio Durigan Junior <sergiodj@debian.org>
Gbp-Pq: Name fix-python-version-comparison.patch

bindings/python/Jamfile

index 2da82a1882e24694c7f2251b80e073ec03727d03..c5d8f6a9920f47c00e941c53a4f9e2c4b46566f2 100644 (file)
@@ -85,6 +85,8 @@ else
                <include>/usr/sfw/include
        ;
 
+       import version ;
+
        rule boost_python_version ( name : type ? : properties * )
        {
                # examples of names for the boost_python library:
@@ -110,14 +112,18 @@ else
                # debian jessie (1.55.0): libboost_python-py34.so.1.55.0
                # boost Jamfile:          libboost_python38.so.1.73.0
 
-               local py-version = [ $(properties).get <python> ] ;
-
+               local py-version-str = [ $(properties).get <python> ] ;
+               local py-version = "" ;
                local infix = "" ;
-               if $(py-version) < 3.7 && [ $(properties).get <target-os> ] = linux
-               {
-                       infix = "-py" ;
+               if $(py-version-str) {
+                       py-version = [ SPLIT_BY_CHARACTERS $(py-version-str) : "." ] ;
+
+                       if [ version.version-less $(py-version) : 3 7 ] && [ $(properties).get <target-os> ] = linux
+                       {
+                               infix = "-py" ;
+                       }
                }
-               local boost-python-lib = "boost_python" $(infix) [ SPLIT_BY_CHARACTERS $(py-version) : "." ] ;
+               local boost-python-lib = "boost_python" $(infix) $(py-version) ;
 
                if $(type) in SEARCHED_LIB
                {