Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | # |
| 2 | # Copyright OpenEmbedded Contributors |
| 3 | # |
| 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
| 7 | inherit setuptools3-base python_pep517 |
| 8 | |
| 9 | DEPENDS += "python3-setuptools-native python3-wheel-native" |
| 10 | |
| 11 | SETUPTOOLS_BUILD_ARGS ?= "" |
| 12 | |
| 13 | SETUPTOOLS_SETUP_PATH ?= "${S}" |
| 14 | |
Patrick Williams | 8460358 | 2024-12-14 08:00:57 -0500 | [diff] [blame] | 15 | python do_check_backend() { |
| 16 | import re |
| 17 | filename = d.expand("${SETUPTOOLS_SETUP_PATH}/pyproject.toml") |
| 18 | if os.path.exists(filename): |
| 19 | for line in open(filename): |
| 20 | match = re.match(r"build-backend\s*=\s*\W([\w.]+)\W", line) |
| 21 | if not match: continue |
| 22 | |
| 23 | msg = f"inherits setuptools3 but has pyproject.toml with {match[1]}, use the correct class" |
| 24 | if "pep517-backend" not in (d.getVar("INSANE_SKIP") or "").split(): |
| 25 | oe.qa.handle_error("pep517-backend", msg, d) |
| 26 | } |
| 27 | addtask check_backend after do_patch before do_configure |
| 28 | |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 29 | setuptools3_do_configure() { |
| 30 | : |
| 31 | } |
| 32 | |
| 33 | setuptools3_do_compile() { |
| 34 | cd ${SETUPTOOLS_SETUP_PATH} |
| 35 | NO_FETCH_BUILD=1 \ |
| 36 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 37 | STAGING_LIBDIR=${STAGING_LIBDIR} \ |
Patrick Williams | 73bd93f | 2024-02-20 08:07:48 -0600 | [diff] [blame] | 38 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py \ |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 39 | bdist_wheel --verbose --dist-dir ${PEP517_WHEEL_PATH} ${SETUPTOOLS_BUILD_ARGS} || \ |
Patrick Williams | 73bd93f | 2024-02-20 08:07:48 -0600 | [diff] [blame] | 40 | bbfatal_log "'python3 setup.py bdist_wheel ${SETUPTOOLS_BUILD_ARGS}' execution failed." |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 41 | } |
| 42 | setuptools3_do_compile[vardepsexclude] = "MACHINE" |
| 43 | do_compile[cleandirs] += "${PEP517_WHEEL_PATH}" |
| 44 | |
| 45 | # This could be removed in the future but some recipes in meta-oe still use it |
| 46 | setuptools3_do_install() { |
| 47 | python_pep517_do_install |
| 48 | } |
| 49 | |
| 50 | EXPORT_FUNCTIONS do_configure do_compile do_install |
| 51 | |
Patrick Williams | 96e4b4e | 2025-02-03 15:49:15 -0500 | [diff] [blame] | 52 | export LDSHARED = "${CCLD} -shared" |