diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-08-07 12:37:21 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-08-07 12:37:21 +0100 |
commit | b8c7370a682e4e29cda623222d17a790c01c3642 (patch) | |
tree | f6caa14689bd00a5760eadaa381ff41e50ef3c1b /eclass/distutils-r1.eclass | |
parent | 8a4997a7e2d1e36c089d4d76935b5a902d98d3d0 (diff) |
gentoo auto-resync : 07:08:2024 - 12:37:20
Diffstat (limited to 'eclass/distutils-r1.eclass')
-rw-r--r-- | eclass/distutils-r1.eclass | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 61c0a80323ec..0f9dc8d14d5e 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -195,7 +195,6 @@ esac # @CODE # @ECLASS_VARIABLE: DISTUTILS_ALLOW_WHEEL_REUSE -# @DEFAULT_UNSET # @USER_VARIABLE # @DESCRIPTION: # If set to a non-empty value, the eclass is allowed to reuse a wheel @@ -205,6 +204,7 @@ esac # This is an optimization that can avoid the overhead of calling into # the build system in pure Python packages and packages using the stable # Python ABI. +: ${DISTUTILS_ALLOW_WHEEL_REUSE=1} # @ECLASS_VARIABLE: BUILD_DIR # @OUTPUT_VARIABLE @@ -572,6 +572,9 @@ distutils_enable_sphinx() { # with the specified test runner. Also copies the current value # of RDEPEND to test?-BDEPEND. The test-runner argument must be one of: # +# - import-check: `pytest --import-check` fallback (for use when there are +# no tests to run) +# # - pytest: dev-python/pytest # # - setup.py: setup.py test (no deps included) @@ -597,9 +600,13 @@ distutils_enable_tests() { [[ ${#} -eq 1 ]] || die "${FUNCNAME} takes exactly one argument: test-runner" local test_deps=${RDEPEND} + local test_pkgs= case ${1} in + import-check) + test_pkgs+=' dev-python/pytest-import-check[${PYTHON_USEDEP}]' + ;& pytest) - local test_pkgs='>=dev-python/pytest-7.4.4[${PYTHON_USEDEP}]' + test_pkgs+=' >=dev-python/pytest-7.4.4[${PYTHON_USEDEP}]' if [[ -n ${EPYTEST_TIMEOUT} ]]; then test_pkgs+=' dev-python/pytest-timeout[${PYTHON_USEDEP}]' fi @@ -929,6 +936,7 @@ _distutils-r1_print_package_versions() { # distutils patches and/or quirks. distutils-r1_python_prepare_all() { debug-print-function ${FUNCNAME} "${@}" + _python_sanity_checks _distutils-r1_check_all_phase_mismatch if [[ ! ${DISTUTILS_OPTIONAL} ]]; then @@ -1244,7 +1252,9 @@ distutils_pep517_install() { die "mydistutilsargs are banned in PEP517 mode (use DISTUTILS_ARGS)" fi - local config_settings= + local cmd=() config_settings= + has cargo ${INHERITED} && cmd+=( cargo_env ) + case ${DISTUTILS_USE_PEP517} in maturin) # `maturin pep517 build-wheel --help` for options @@ -1381,9 +1391,14 @@ distutils_pep517_install() { ;; esac + # https://pyo3.rs/latest/building-and-distribution.html#cross-compiling + if tc-is-cross-compiler; then + local -x PYO3_CROSS_LIB_DIR=${SYSROOT}/$(python_get_stdlib) + fi + local build_backend=$(_distutils-r1_get_backend) einfo " Building the wheel for ${PWD#${WORKDIR}/} via ${build_backend}" - local cmd=( + cmd+=( "${EPYTHON}" -m gpep517 build-wheel --prefix="${EPREFIX}/usr" --backend "${build_backend}" @@ -1560,6 +1575,9 @@ distutils-r1_python_test() { _python_check_EPYTHON case ${_DISTUTILS_TEST_RUNNER} in + import-check) + epytest --import-check "${BUILD_DIR}/install$(python_get_sitedir)" + ;; pytest) epytest ;; @@ -1782,16 +1800,6 @@ distutils-r1_run_phase() { # bug fixes from Cython (this works only when setup.py is using # cythonize() but it's better than nothing) local -x CYTHON_FORCE_REGEN=1 - - # Rust extensions are incompatible with C/C++ LTO compiler - # see e.g. https://bugs.gentoo.org/910220 - if has cargo ${INHERITED}; then - local x - for x in $(all-flag-vars); do - local -x "${x}=${!x}" - done - filter-lto - fi fi # silence warnings when pydevd is loaded on Python 3.11+ @@ -1933,7 +1941,7 @@ _distutils-r1_compare_installed_files() { # Perform the check only if at least one potentially reusable wheel # has been produced. Nonpure packages (e.g. NumPy) may install # interpreter configuration details into sitedir. - if [[ ${!DISTUTILS_WHEELS[*]} != *-none-any.whl* && + if [[ ${!DISTUTILS_WHEELS[*]} != *py3-none-any.whl* && ${!DISTUTILS_WHEELS[*]} != *-abi3-*.whl ]]; then return fi |