Python3: replace distutils with sysconfig

- `distutils` module is long time deprecated and already deleted
  from the CPython mainline.

- To remain compatible with Debian/Ubuntu Python3 packaging style,
  try
  `distutils.sysconfig.get_python_path(0,0)`
  first with fallback on
  `sysconfig.get_path('purelib')`

- pyzfs_unittest suite is run unconditionally as a part of ZTS.

- Add pyzfs_unittest suite to sanity tests.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes #12833 
Closes #13280 
Closes #14177
This commit is contained in:
Damian Szuberski
2022-11-29 05:39:41 +10:00
committed by GitHub
parent 5f45e3f699
commit 387109364e
5 changed files with 26 additions and 56 deletions
@@ -18,6 +18,8 @@
if [ -n "$ASAN_OPTIONS" ]; then
export LD_PRELOAD=$(ldd "$(command -v zfs)" | awk '/libasan\.so/ {print $3}')
# ASan reports leaks in CPython 3.10
ASAN_OPTIONS="$ASAN_OPTIONS:detect_leaks=false"
fi
#
@@ -30,20 +32,6 @@ fi
#
verify_runnable "global"
# Verify that the required dependencies for testing are installed.
@PYTHON@ -c "import cffi" 2>/dev/null ||
log_unsupported "python3-cffi not found by Python"
# We don't just try to "import libzfs_core" because we want to skip these tests
# only if pyzfs was not installed due to missing, build-time, dependencies; if
# we cannot load "libzfs_core" due to other reasons, for instance an API/ABI
# mismatch, we want to report it.
@PYTHON@ -c '
import pkgutil, sys
sys.exit(pkgutil.find_loader("libzfs_core") is None)' ||
log_unsupported "libzfs_core not found by Python"
log_assert "Verify the nvlist and libzfs_core Python unittest run successfully"
# log_must buffers stderr, which interacts badly with