it seems that the spec file only checking python on rhel8 not centos 8
%global RHEL8 %(if test grep -E '^(ID="rhel"|VERSION="8)' /etc/os-release 2>/dev/null | wc -l
-eq 2; then echo -n ‘1’; else echo -n ‘0’; fi)
…
%if %{RHEL8}
%global mlnx_python_env export MLNX_PYTHON_EXECUTABLE=python3
%else
%global mlnx_python_env :
This would lead to error when build on CentOS 8
20:28:55 + make build_py_scripts
20:28:55 cd ofed_scripts/utils && python setup.py build && cd -
20:28:55 DEPRECATION WARNING: python2 invoked with /usr/bin/python.
20:28:55 Use /usr/bin/python3 or /usr/bin/python2
…
20:29:17 + /usr/lib/rpm/redhat/brp-mangle-shebangs
20:29:18 *** WARNING: ./usr/src/ofa_kernel-4.7/ofed_scripts/compat_gid_gen is executable but has empty or no shebang, removing executable bit
20:29:18 *** ERROR: ambiguous python shebang in /usr/src/ofa_kernel-4.7/ofed_scripts/utils/mlnx_mcg: #!/usr/bin/python. Change it to python3 (or python2) explicitly.
it was built fine on RHEL8