diff options
author | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-01-06 13:01:32 -0600 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-01-14 14:36:39 -0600 |
commit | 6d746fd2963a8461cb38efb4189388f96bf1f93e (patch) | |
tree | 683bb8f5d724c264e98ca2aa7639153feac7e534 /mpm | |
parent | 88d284816e8e91dda17b7a3edcbdfeec89de4843 (diff) | |
download | uhd-6d746fd2963a8461cb38efb4189388f96bf1f93e.tar.gz uhd-6d746fd2963a8461cb38efb4189388f96bf1f93e.tar.bz2 uhd-6d746fd2963a8461cb38efb4189388f96bf1f93e.zip |
cmake: Replace distutils with CMake for version checks
This commit replaces the use of distutils.version.LooseVersion() with
CMake's version comparison operator, which implements relational version
string checking in the same manner (i.e., comparing numeric components
of a version string numerically).
Diffstat (limited to 'mpm')
-rw-r--r-- | mpm/CMakeLists.txt | 8 | ||||
-rw-r--r-- | mpm/python/CMakeLists.txt | 26 |
2 files changed, 21 insertions, 13 deletions
diff --git a/mpm/CMakeLists.txt b/mpm/CMakeLists.txt index 7596529dc..0a152b1b9 100644 --- a/mpm/CMakeLists.txt +++ b/mpm/CMakeLists.txt @@ -35,9 +35,11 @@ include(UHDPython) ######################################################################## # Find Python Modules ######################################################################## -PYTHON_CHECK_MODULE( - "Mako templates 0.4.2 or greater" - "mako" "mako.__version__ >= '0.4.2'" +PYTHON_CHECK_MODULE_VERSION( + "Mako templates" + "mako" + "mako.__version__" + "0.4.2" HAVE_PYTHON_MODULE_MAKO ) diff --git a/mpm/python/CMakeLists.txt b/mpm/python/CMakeLists.txt index b15578484..d5106b1b3 100644 --- a/mpm/python/CMakeLists.txt +++ b/mpm/python/CMakeLists.txt @@ -12,31 +12,37 @@ set(GEVENT_MIN_VERSION "1.4.0") set(PYUDEV_MIN_VERSION "0.21.0") -PYTHON_CHECK_MODULE( - "gevent ${GEVENT_MIN_VERSION} or greater" - "gevent" "LooseVersion(gevent.__version__) >= LooseVersion('${GEVENT_MIN_VERSION}')" +PYTHON_CHECK_MODULE_VERSION( + "gevent module" + "gevent" + "gevent.__version__" + ${GEVENT_MIN_VERSION} HAVE_PYTHON_MODULE_GEVENT ) # mprpc does not expose a __version__ attribute, so merely check for its -# presence. +# presence PYTHON_CHECK_MODULE( + "mprpc module" "mprpc" - "mprpc" "True" + "True" HAVE_PYTHON_MODULE_MPRPC ) -PYTHON_CHECK_MODULE( - "pyudev ${PYUDEV_MIN_VERSION} or greater" - "pyudev" "LooseVersion(pyudev.__version__) >= LooseVersion('${PYUDEV_MIN_VERSION}')" +PYTHON_CHECK_MODULE_VERSION( + "pyudev module" + "pyudev" + "pyudev.__version__" + ${PYUDEV_MIN_VERSION} HAVE_PYTHON_MODULE_PYUDEV ) # Older versions of pyroute2 (e.g. 0.5.2) do not expose a __version__ # attribute, so merely check for its presence. PYTHON_CHECK_MODULE( - "pyroute2" - "pyroute2" "True" + "pyroute2 module" + "pyroute2" + "True" HAVE_PYTHON_MODULE_PYROUTE2 ) |