All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-python][PATCH v2 1/4] python_mesonpy.bbclass: New class
@ 2023-03-17  7:25 Zoltán Böszörményi
  2023-03-17  7:25 ` [meta-python][PATCH v2 2/4] python3-patchelf: New recipe Zoltán Böszörményi
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Zoltán Böszörményi @ 2023-03-17  7:25 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Zoltán Böszörményi

Some python modules (e.g. SciPy, scikit-image) use meson-python
(a.k.a. mesonpy) in pyproject.toml:

    [build-system]
    build-backend = 'mesonpy'

This class, together with python3-meson-python and its dependencies
will allow building such modules.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
---
 meta-python/classes/python_mesonpy.bbclass | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 meta-python/classes/python_mesonpy.bbclass

diff --git a/meta-python/classes/python_mesonpy.bbclass b/meta-python/classes/python_mesonpy.bbclass
new file mode 100644
index 000000000..f4c4a217a
--- /dev/null
+++ b/meta-python/classes/python_mesonpy.bbclass
@@ -0,0 +1,17 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit setuptools3-base python3targetconfig python_pep517 meson-common
+
+DEPENDS += "python3-wheel-native python3-meson-python-native"
+
+PEP517_BUILD_OPTS = '--config-setting=setup-args="${MESONOPTS} ${MESON_SOURCEPATH} ${B} ${MESON_CROSS_FILE} ${EXTRA_OEMESON}"'
+
+export MESONPY_BUILD = "${B}"
+
+# Python pyx -> c -> so build leaves absolute build paths in the code
+INSANE_SKIP:${PN} += "buildpaths"
+INSANE_SKIP:${PN}-src += "buildpaths"
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [meta-python][PATCH v2 2/4] python3-patchelf: New recipe
  2023-03-17  7:25 [meta-python][PATCH v2 1/4] python_mesonpy.bbclass: New class Zoltán Böszörményi
@ 2023-03-17  7:25 ` Zoltán Böszörményi
  2023-03-20 16:09   ` [oe] " Ross Burton
  2023-03-17  7:25 ` [meta-python][PATCH v2 3/4] python3-pyproject-metadata: " Zoltán Böszörményi
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Zoltán Böszörményi @ 2023-03-17  7:25 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Zoltán Böszörményi

Dummy module to indicate the presence of patchelf.
Used by python3-meson-python.

The CMakeLists.txt file is a crippled copy from this patchelf
python module's sources, removing almost everything, and
adding a dummy install target, so do_install() doesn't fail.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
---
 .../python/python3-patchelf/CMakeLists.txt    |  7 +++++
 .../python/python3-patchelf/patchelf.patch    | 11 +++++++
 .../python/python3-patchelf_0.17.2.1.bb       | 31 +++++++++++++++++++
 3 files changed, 49 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-patchelf/CMakeLists.txt
 create mode 100644 meta-python/recipes-devtools/python/python3-patchelf/patchelf.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-patchelf_0.17.2.1.bb

diff --git a/meta-python/recipes-devtools/python/python3-patchelf/CMakeLists.txt b/meta-python/recipes-devtools/python/python3-patchelf/CMakeLists.txt
new file mode 100644
index 000000000..335bb503f
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-patchelf/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.6)
+
+project(PatchelfPythonDistributions)
+
+install(CODE "
+ message(STATUS \"Install patchelf project\")
+")
diff --git a/meta-python/recipes-devtools/python/python3-patchelf/patchelf.patch b/meta-python/recipes-devtools/python/python3-patchelf/patchelf.patch
new file mode 100644
index 000000000..96dbf2180
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-patchelf/patchelf.patch
@@ -0,0 +1,11 @@
+--- patchelf-0.17.2.1/setup.py.old	2023-03-13 10:12:55.951514413 +0100
++++ patchelf-0.17.2.1/setup.py	2023-03-13 10:13:18.877751074 +0100
+@@ -95,8 +95,6 @@
+     version=get_version(),
+     cmdclass=cmdclass,
+ 
+-    scripts=["bin/patchelf"],
+-
+     url="https://github.com/NixOS/patchelf",
+     project_urls={
+         "Source Code": "https://github.com/mayeut/patchelf-pypi",
diff --git a/meta-python/recipes-devtools/python/python3-patchelf_0.17.2.1.bb b/meta-python/recipes-devtools/python/python3-patchelf_0.17.2.1.bb
new file mode 100644
index 000000000..630bd808a
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-patchelf_0.17.2.1.bb
@@ -0,0 +1,31 @@
+# This is a dummy package needed by python3-meson-python
+SUMMARY = "A small utility to modify the dynamic linker and RPATH of ELF executables."
+LICENSE = "GPL-3.0-or-later & Apache-2.0"
+LIC_FILES_CHKSUM = " \
+    file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327 \
+    file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
+"
+
+DEPENDS = "python3-scikit-build-native"
+
+PYPI_PACKAGE = "patchelf"
+PYPI_ARCHIVE_NAME_PREFIX = "pypi-"
+
+inherit pypi python_setuptools_build_meta
+SRC_URI[sha256sum] = "a6eb0dd452ce4127d0d5e1eb26515e39186fa609364274bc1b0b77539cfa7031"
+
+SRC_URI += " \
+    file://CMakeLists.txt \
+    file://patchelf.patch \
+"
+
+addtask do_patchbuild after do_patch before do_configure
+
+do_patchbuild () {
+    rm -f ${S}/CMakeLists.txt
+    cp ${WORKDIR}/CMakeLists.txt ${S}/
+}
+
+RDEPENDS:${PN} = "patchelf"
+
+BBCLASSEXTEND = "native nativesdk"
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [meta-python][PATCH v2 3/4] python3-pyproject-metadata: New recipe
  2023-03-17  7:25 [meta-python][PATCH v2 1/4] python_mesonpy.bbclass: New class Zoltán Böszörményi
  2023-03-17  7:25 ` [meta-python][PATCH v2 2/4] python3-patchelf: New recipe Zoltán Böszörményi
@ 2023-03-17  7:25 ` Zoltán Böszörményi
  2023-03-20 14:45   ` [oe] " Ross Burton
  2023-03-17  7:25 ` [meta-python][PATCH v2 4/4] python3-meson-python: " Zoltán Böszörményi
  2023-03-20 14:46 ` [oe] [meta-python][PATCH v2 1/4] python_mesonpy.bbclass: New class Ross Burton
  3 siblings, 1 reply; 12+ messages in thread
From: Zoltán Böszörményi @ 2023-03-17  7:25 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Zoltán Böszörményi

Dependency of python3-meson-python.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
---
 .../python/python3-pyproject-metadata_0.7.1.bb         | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-pyproject-metadata_0.7.1.bb

diff --git a/meta-python/recipes-devtools/python/python3-pyproject-metadata_0.7.1.bb b/meta-python/recipes-devtools/python/python3-pyproject-metadata_0.7.1.bb
new file mode 100644
index 000000000..32938421d
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-pyproject-metadata_0.7.1.bb
@@ -0,0 +1,10 @@
+SUMMARY = "PEP 621 metadata parsing"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=310439af287b0fb4780b2ad6907c256c"
+
+PYPI_PACKAGE = "pyproject-metadata"
+
+inherit pypi python_setuptools_build_meta
+SRC_URI[sha256sum] = "0a94f18b108b9b21f3a26a3d541f056c34edcb17dc872a144a15618fed7aef67"
+
+BBCLASSEXTEND = "native nativesdk"
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [meta-python][PATCH v2 4/4] python3-meson-python: New recipe
  2023-03-17  7:25 [meta-python][PATCH v2 1/4] python_mesonpy.bbclass: New class Zoltán Böszörményi
  2023-03-17  7:25 ` [meta-python][PATCH v2 2/4] python3-patchelf: New recipe Zoltán Böszörményi
  2023-03-17  7:25 ` [meta-python][PATCH v2 3/4] python3-pyproject-metadata: " Zoltán Böszörményi
@ 2023-03-17  7:25 ` Zoltán Böszörményi
  2023-03-20 14:52   ` [oe] " Ross Burton
  2023-03-20 14:46 ` [oe] [meta-python][PATCH v2 1/4] python_mesonpy.bbclass: New class Ross Burton
  3 siblings, 1 reply; 12+ messages in thread
From: Zoltán Böszörményi @ 2023-03-17  7:25 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Zoltán Böszörményi

Used by inherit python_mesonpy.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
---
 .../remove-hardcoded-setup-args.patch         | 123 ++++++++++++++++++
 .../use-installed-mesonpy.patch               |   9 ++
 .../python3-meson-python_0.13.0.pre0.bb       |  28 ++++
 3 files changed, 160 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-meson-python/remove-hardcoded-setup-args.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-meson-python/use-installed-mesonpy.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-meson-python_0.13.0.pre0.bb

diff --git a/meta-python/recipes-devtools/python/python3-meson-python/remove-hardcoded-setup-args.patch b/meta-python/recipes-devtools/python/python3-meson-python/remove-hardcoded-setup-args.patch
new file mode 100644
index 000000000..3edda85dc
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-meson-python/remove-hardcoded-setup-args.patch
@@ -0,0 +1,123 @@
+--- meson_python-0.13.0.pre0/mesonpy/__init__.py.old	1970-01-01 01:00:00.000000000 +0100
++++ meson_python-0.13.0.pre0/mesonpy/__init__.py	2023-03-13 21:26:52.263117416 +0100
+@@ -669,8 +669,6 @@
+         self._build_dir = pathlib.Path(build_dir).absolute() if build_dir else (self._working_dir / 'build')
+         self._editable_verbose = editable_verbose
+         self._install_dir = self._working_dir / 'install'
+-        self._meson_native_file = self._source_dir / '.mesonpy-native-file.ini'
+-        self._meson_cross_file = self._source_dir / '.mesonpy-cross-file.ini'
+         self._meson_args: MesonArgs = collections.defaultdict(list)
+         self._env = os.environ.copy()
+ 
+@@ -679,32 +677,6 @@
+         if ninja_path is not None:
+             self._env.setdefault('NINJA', str(ninja_path))
+ 
+-        # setuptools-like ARCHFLAGS environment variable support
+-        if sysconfig.get_platform().startswith('macosx-'):
+-            archflags = self._env.get('ARCHFLAGS')
+-            if archflags is not None:
+-                arch, *other = filter(None, (x.strip() for x in archflags.split('-arch')))
+-                if other:
+-                    raise ConfigError(f'Multi-architecture builds are not supported but $ARCHFLAGS={archflags!r}')
+-                macver, _, nativearch = platform.mac_ver()
+-                if arch != nativearch:
+-                    x = self._env.setdefault('_PYTHON_HOST_PLATFORM', f'macosx-{macver}-{arch}')
+-                    if not x.endswith(arch):
+-                        raise ConfigError(f'$ARCHFLAGS={archflags!r} and $_PYTHON_HOST_PLATFORM={x!r} do not agree')
+-                    family = 'aarch64' if arch == 'arm64' else arch
+-                    cross_file_data = textwrap.dedent(f'''
+-                        [binaries]
+-                        c = ['cc', '-arch', {arch!r}]
+-                        cpp = ['c++', '-arch', {arch!r}]
+-                        [host_machine]
+-                        system = 'Darwin'
+-                        cpu = {arch!r}
+-                        cpu_family = {family!r}
+-                        endian = 'little'
+-                    ''')
+-                    self._meson_cross_file.write_text(cross_file_data)
+-                    self._meson_args['setup'].extend(('--cross-file', os.fspath(self._meson_cross_file)))
+-
+         # load config -- PEP 621 support is optional
+         self._config = tomllib.loads(self._source_dir.joinpath('pyproject.toml').read_text())
+         self._pep621 = 'project' in self._config
+@@ -749,19 +721,6 @@
+             [binaries]
+             python = '{sys.executable}'
+         ''')
+-        native_file_mismatch = (
+-            not self._meson_native_file.exists()
+-            or self._meson_native_file.read_text() != native_file_data
+-        )
+-        if native_file_mismatch:
+-            try:
+-                self._meson_native_file.write_text(native_file_data)
+-            except OSError:
+-                # if there are permission errors or something else in the source
+-                # directory, put the native file in the working directory instead
+-                # (this won't survive multiple calls -- Meson will have to be reconfigured)
+-                self._meson_native_file = self._working_dir / '.mesonpy-native-file.ini'
+-                self._meson_native_file.write_text(native_file_data)
+ 
+         # Don't reconfigure if build directory doesn't have meson-private/coredata.data
+         # (means something went wrong)
+@@ -784,7 +743,7 @@
+     def _proc(self, *args: str) -> None:
+         """Invoke a subprocess."""
+         print('{cyan}{bold}+ {}{reset}'.format(' '.join(args), **_STYLES))
+-        r = subprocess.run(list(args), env=self._env, cwd=self._build_dir)
++        r = subprocess.run(' '.join(list(args)).split(), env=self._env, cwd=self._build_dir)
+         if r.returncode != 0:
+             raise SystemExit(r.returncode)
+ 
+@@ -800,22 +759,6 @@
+         """
+         sys_paths = mesonpy._introspection.SYSCONFIG_PATHS
+         setup_args = [
+-            f'--prefix={sys.base_prefix}',
+-            os.fspath(self._source_dir),
+-            os.fspath(self._build_dir),
+-            f'--native-file={os.fspath(self._meson_native_file)}',
+-            # TODO: Allow configuring these arguments
+-            '-Ddebug=false',
+-            '-Doptimization=2',
+-
+-            # XXX: This should not be needed, but Meson is using the wrong paths
+-            #      in some scenarios, like on macOS.
+-            #      https://github.com/mesonbuild/meson-python/pull/87#discussion_r1047041306
+-            '--python.purelibdir',
+-            sys_paths['purelib'],
+-            '--python.platlibdir',
+-            sys_paths['platlib'],
+-
+             # user args
+             *self._meson_args['setup'],
+         ]
+@@ -905,8 +848,7 @@
+         editable_verbose: bool = False,
+     ) -> Iterator[Project]:
+         """Creates a project instance pointing to a temporary working directory."""
+-        with tempfile.TemporaryDirectory(prefix='.mesonpy-', dir=os.fspath(source_dir)) as tmpdir:
+-            yield cls(source_dir, tmpdir, build_dir, meson_args, editable_verbose)
++        yield cls(source_dir, build_dir, build_dir, meson_args, editable_verbose)
+ 
+     @functools.lru_cache()
+     def _info(self, name: str) -> Dict[str, Any]:
+@@ -1105,15 +1047,7 @@
+         for key, value in config_settings.items()
+     }
+ 
+-    builddir_value = config_settings.get('builddir', {})
+-    if len(builddir_value) > 0:
+-        if len(builddir_value) != 1:
+-            raise ConfigError('Only one value for configuration entry "builddir" can be specified')
+-        builddir = builddir_value[0]
+-        if not isinstance(builddir, str):
+-            raise ConfigError(f'Configuration entry "builddir" should be a string not {type(builddir)}')
+-    else:
+-        builddir = None
++    builddir = os.environ.get('MESONPY_BUILD')
+ 
+     def _validate_string_collection(key: str) -> None:
+         assert isinstance(config_settings, Mapping)
diff --git a/meta-python/recipes-devtools/python/python3-meson-python/use-installed-mesonpy.patch b/meta-python/recipes-devtools/python/python3-meson-python/use-installed-mesonpy.patch
new file mode 100644
index 000000000..64c2c304c
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-meson-python/use-installed-mesonpy.patch
@@ -0,0 +1,9 @@
+--- meson_python-0.13.0.pre0/pyproject.toml.old	2023-03-14 08:55:19.092987968 +0100
++++ meson_python-0.13.0.pre0/pyproject.toml	2023-03-14 08:55:40.108672980 +0100
+@@ -1,6 +1,5 @@
+ [build-system]
+ build-backend = 'mesonpy'
+-backend-path = ['.']
+ requires = [
+   'meson>=0.63.3',
+   'pyproject-metadata>=0.7.1',
diff --git a/meta-python/recipes-devtools/python/python3-meson-python_0.13.0.pre0.bb b/meta-python/recipes-devtools/python/python3-meson-python_0.13.0.pre0.bb
new file mode 100644
index 000000000..a113408d7
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-meson-python_0.13.0.pre0.bb
@@ -0,0 +1,28 @@
+SUMMARY = "Meson Python build backend (PEP 517)"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=d580b27e67cc0892a5b005b0be114b60"
+
+DEPENDS = " \
+	meson-native ninja-native python3-ninja-native \
+	python3-pyproject-metadata-native \
+	python3-patchelf-native \
+"
+
+PYPI_PACKAGE = "meson_python"
+
+inherit pypi python_mesonpy
+SRC_URI[sha256sum] = "8d537a0304709c31c11ffa34872a62a4c06a6a6c24fc862b7fb4306f3e881b95"
+
+DEPENDS:remove:class-native = "python3-meson-python-native"
+
+SRC_URI:append:class-native = "file://remove-hardcoded-setup-args.patch"
+SRC_URI:append:class-nativesdk = "file://use-installed-mesonpy.patch"
+SRC_URI:append:class-target = "file://use-installed-mesonpy.patch"
+
+RDEPENDS:${PN} = " \
+	meson ninja python3-ninja \
+	python3-pyproject-metadata \
+	python3-patchelf \
+"
+
+BBCLASSEXTEND = "native nativesdk"
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [oe] [meta-python][PATCH v2 3/4] python3-pyproject-metadata: New recipe
  2023-03-17  7:25 ` [meta-python][PATCH v2 3/4] python3-pyproject-metadata: " Zoltán Böszörményi
@ 2023-03-20 14:45   ` Ross Burton
  0 siblings, 0 replies; 12+ messages in thread
From: Ross Burton @ 2023-03-20 14:45 UTC (permalink / raw)
  To: zboszor; +Cc: openembedded-devel

On 17 Mar 2023, at 07:25, Zoltan Boszormenyi via lists.openembedded.org <zboszor=gmail.com@lists.openembedded.org> wrote:
> +PYPI_PACKAGE = "pyproject-metadata”

This can be removed as that’s the default value.

Ross

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [oe] [meta-python][PATCH v2 1/4] python_mesonpy.bbclass: New class
  2023-03-17  7:25 [meta-python][PATCH v2 1/4] python_mesonpy.bbclass: New class Zoltán Böszörményi
                   ` (2 preceding siblings ...)
  2023-03-17  7:25 ` [meta-python][PATCH v2 4/4] python3-meson-python: " Zoltán Böszörményi
@ 2023-03-20 14:46 ` Ross Burton
  2023-03-20 15:01   ` Böszörményi Zoltán
  3 siblings, 1 reply; 12+ messages in thread
From: Ross Burton @ 2023-03-20 14:46 UTC (permalink / raw)
  To: Böszörményi Zoltán; +Cc: openembedded-devel

On 17 Mar 2023, at 07:25, Zoltan Boszormenyi via lists.openembedded.org <zboszor=gmail.com@lists.openembedded.org> wrote:
> +inherit setuptools3-base python3targetconfig python_pep517 meson-common

I still don’t see why you need to split the meson class up.

Ross

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [oe] [meta-python][PATCH v2 4/4] python3-meson-python: New recipe
  2023-03-17  7:25 ` [meta-python][PATCH v2 4/4] python3-meson-python: " Zoltán Böszörményi
@ 2023-03-20 14:52   ` Ross Burton
  0 siblings, 0 replies; 12+ messages in thread
From: Ross Burton @ 2023-03-20 14:52 UTC (permalink / raw)
  To: Böszörményi Zoltán; +Cc: openembedded-devel

On 17 Mar 2023, at 07:25, Zoltan Boszormenyi via lists.openembedded.org <zboszor=gmail.com@lists.openembedded.org> wrote:
> +++ b/meta-python/recipes-devtools/python/python3-meson-python/remove-hardcoded-setup-args.patch

This patch has no explanation, upstream-status, or signed-off-by.

> +++ b/meta-python/recipes-devtools/python/python3-meson-python/use-installed-mesonpy.patch

Ditto.

> @@ -0,0 +1,9 @@
> +--- meson_python-0.13.0.pre0/pyproject.toml.old 2023-03-14 08:55:19.092987968 +0100
> ++++ meson_python-0.13.0.pre0/pyproject.toml 2023-03-14 08:55:40.108672980 +0100
> +@@ -1,6 +1,5 @@
> + [build-system]
> + build-backend = 'mesonpy'
> +-backend-path = ['.']
> + requires = [
> +   'meson>=0.63.3',
> +   'pyproject-metadata>=0.7.1',
> diff --git a/meta-python/recipes-devtools/python/python3-meson-python_0.13.0.pre0.bb b/meta-python/recipes-devtools/python/python3-meson-python_0.13.0.pre0.bb
> new file mode 100644
> index 000000000..a113408d7
> --- /dev/null
> +++ b/meta-python/recipes-devtools/python/python3-meson-python_0.13.0.pre0.bb
> @@ -0,0 +1,28 @@
> +SUMMARY = "Meson Python build backend (PEP 517)"
> +LICENSE = "MIT"
> +LIC_FILES_CHKSUM = "file://LICENSE;md5=d580b27e67cc0892a5b005b0be114b60"
> +
> +DEPENDS = " \
> + meson-native ninja-native python3-ninja-native \

The python_mesonpy class depends on meson and ninja, so those can be removed.

Also the python3-ninja recipe is another waste of time and space, and should be removed.

> +SRC_URI:append:class-native = "file://remove-hardcoded-setup-args.patch"

This might break nativesdk where we also write cross files.

> +RDEPENDS:${PN} = " \
> + meson ninja python3-ninja \
> + python3-pyproject-metadata \
> + python3-patchelf \
> +"

Does mesonpy actually look for patchelf and ninja modules *at runtime*, or does it just use $PATH? If the latter you can depend on the actual binaries instead of the wrappers.

Ross

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [oe] [meta-python][PATCH v2 1/4] python_mesonpy.bbclass: New class
  2023-03-20 14:46 ` [oe] [meta-python][PATCH v2 1/4] python_mesonpy.bbclass: New class Ross Burton
@ 2023-03-20 15:01   ` Böszörményi Zoltán
  2023-03-20 16:26     ` Ross Burton
  0 siblings, 1 reply; 12+ messages in thread
From: Böszörményi Zoltán @ 2023-03-20 15:01 UTC (permalink / raw)
  To: Ross Burton; +Cc: openembedded-devel

2023. 03. 20. 15:46 keltezéssel, Ross Burton írta:
> On 17 Mar 2023, at 07:25, Zoltan Boszormenyi via lists.openembedded.org <zboszor=gmail.com@lists.openembedded.org> wrote:
>> +inherit setuptools3-base python3targetconfig python_pep517 meson-common
> I still don’t see why you need to split the meson class up.

See the other thread. For some reason, meson always wins
regardless of the inheritance order, so do_configure has
meson_do_configure instead of pep517_do_configure, etc.

>
> Ross



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [oe] [meta-python][PATCH v2 2/4] python3-patchelf: New recipe
  2023-03-17  7:25 ` [meta-python][PATCH v2 2/4] python3-patchelf: New recipe Zoltán Böszörményi
@ 2023-03-20 16:09   ` Ross Burton
  0 siblings, 0 replies; 12+ messages in thread
From: Ross Burton @ 2023-03-20 16:09 UTC (permalink / raw)
  To: Böszörményi Zoltán; +Cc: openembedded-devel

On 17 Mar 2023, at 07:25, Zoltan Boszormenyi via lists.openembedded.org <zboszor=gmail.com@lists.openembedded.org> wrote:
> +# This is a dummy package needed by python3-meson-python

I’m not sure I’d call this a dummy package.

> +DEPENDS = "python3-scikit-build-native"

If you’re not building native code with cmake then you don’t need this, just switch skbuild to setuptools.

> +SRC_URI += " \
> +    file://CMakeLists.txt \
> +    file://patchelf.patch \
> +"
> +
> +addtask do_patchbuild after do_patch before do_configure
> +
> +do_patchbuild () {
> +    rm -f ${S}/CMakeLists.txt
> +    cp ${WORKDIR}/CMakeLists.txt ${S}/
> +}

Use subdir=${S} to put the CMakeLists.txt in the right place instead of doing this.

However, this recipe doesn’t build patchelf and doesn’t have any python code. So what’s the point of it?

If there are packages which depend on this, either patch out that dependency (as we can just DEPEND on patchelf-native) or write the few lines of pyproject.toml to ship an empty package directly.

Ross

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [oe] [meta-python][PATCH v2 1/4] python_mesonpy.bbclass: New class
  2023-03-20 15:01   ` Böszörményi Zoltán
@ 2023-03-20 16:26     ` Ross Burton
  2023-03-22  8:18       ` Böszörményi Zoltán
       [not found]       ` <174EAFE93556A78F.19937@lists.openembedded.org>
  0 siblings, 2 replies; 12+ messages in thread
From: Ross Burton @ 2023-03-20 16:26 UTC (permalink / raw)
  To: Böszörményi Zoltán; +Cc: openembedded-devel

On 20 Mar 2023, at 15:01, Böszörményi Zoltán <zboszor@gmail.com> wrote:
> 
> 2023. 03. 20. 15:46 keltezéssel, Ross Burton írta:
>> On 17 Mar 2023, at 07:25, Zoltan Boszormenyi via lists.openembedded.org <zboszor=gmail.com@lists.openembedded.org> wrote:
>>> +inherit setuptools3-base python3targetconfig python_pep517 meson-common
>> I still don’t see why you need to split the meson class up.
> 
> See the other thread. For some reason, meson always wins
> regardless of the inheritance order, so do_configure has
> meson_do_configure instead of pep517_do_configure, etc.

Add a new do_configure to your class which simply calls the right one.

Ross

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [oe] [meta-python][PATCH v2 1/4] python_mesonpy.bbclass: New class
  2023-03-20 16:26     ` Ross Burton
@ 2023-03-22  8:18       ` Böszörményi Zoltán
       [not found]       ` <174EAFE93556A78F.19937@lists.openembedded.org>
  1 sibling, 0 replies; 12+ messages in thread
From: Böszörményi Zoltán @ 2023-03-22  8:18 UTC (permalink / raw)
  To: Ross Burton; +Cc: openembedded-devel

2023. 03. 20. 17:26 keltezéssel, Ross Burton írta:
> On 20 Mar 2023, at 15:01, Böszörményi Zoltán <zboszor@gmail.com> wrote:
>> 2023. 03. 20. 15:46 keltezéssel, Ross Burton írta:
>>> On 17 Mar 2023, at 07:25, Zoltan Boszormenyi via lists.openembedded.org <zboszor=gmail.com@lists.openembedded.org> wrote:
>>>> +inherit setuptools3-base python3targetconfig python_pep517 meson-common
>>> I still don’t see why you need to split the meson class up.
>> See the other thread. For some reason, meson always wins
>> regardless of the inheritance order, so do_configure has
>> meson_do_configure instead of pep517_do_configure, etc.
> Add a new do_configure to your class which simply calls the right one.

It still doesn't work. meson_do_qa_configure fails with this:

ERROR: python3-meson-python-native-0.13.0.pre0-r0 do_configure: Error executing a python 
function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
      0001:
  *** 0002:meson_do_qa_configure(d)
      0003:
File: 
'/data2/dtd-yocto-4.2/conf/../layers/openembedded-core/meta/classes-recipe/meson.bbclass', 
lineno: 163, function: meson_do_qa_configure
      0159:
      0160:python meson_do_qa_configure() {
      0161:    import re
      0162:    warn_re = re.compile(r"^WARNING: Cross property (.+) is using default value 
(.+)$", re.MULTILINE)
  *** 0163:    with open(d.expand("${B}/meson-logs/meson-log.txt")) as logfile:
      0164:        log = logfile.read()
      0165:    for (prop, value) in warn_re.findall(log):
      0166:        bb.warn("Meson cross property %s used without explicit assignment, 
defaulting to %s" % (prop, value))
      0167:}
Exception: FileNotFoundError: [Errno 2] No such file or directory: 
'/data2/dtd-yocto-4.2/tmp-sicom-glibc/work/x86_64-linux/python3-meson-python-native/0.13.0.pre0-r0/build/meson-logs/meson-log.txt'

ERROR: Logfile of failure stored in: 
/data2/dtd-yocto-4.2/tmp-sicom-glibc/work/x86_64-linux/python3-meson-python-native/0.13.0.pre0-r0/temp/log.do_configure.3235105
ERROR: Task 
(virtual:native:/data2/dtd-yocto-4.2/conf/../layers/meta-sicom/recipes-support/python3/python3-meson-python_0.13.0.pre0.bb:do_configure) 
failed with exit code '1'

Naturally, as running meson's configure stage went from
do_configure to do_compile indirectly via "nativepython3 -m build ..."

Sorry, there seems to be no way around it but splitting out the
environment setup from meson.bbclass into meson-common class.
If you don't like the "-common" naming, I can rename it to
meson-env.bbclass or something like that.

I will still rework python3-meson-python to not require
the dummy patchelf python module and review other
comments and make necessary changes.

Thanks.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [oe] [meta-python][PATCH v2 1/4] python_mesonpy.bbclass: New class
       [not found]       ` <174EAFE93556A78F.19937@lists.openembedded.org>
@ 2023-03-23 11:18         ` Böszörményi Zoltán
  0 siblings, 0 replies; 12+ messages in thread
From: Böszörményi Zoltán @ 2023-03-23 11:18 UTC (permalink / raw)
  To: Ross Burton; +Cc: openembedded-devel

2023. 03. 22. 9:18 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:
> 2023. 03. 20. 17:26 keltezéssel, Ross Burton írta:
>> On 20 Mar 2023, at 15:01, Böszörményi Zoltán <zboszor@gmail.com> wrote:
>>> 2023. 03. 20. 15:46 keltezéssel, Ross Burton írta:
>>>> On 17 Mar 2023, at 07:25, Zoltan Boszormenyi via lists.openembedded.org 
>>>> <zboszor=gmail.com@lists.openembedded.org> wrote:
>>>>> +inherit setuptools3-base python3targetconfig python_pep517 meson-common
>>>> I still don’t see why you need to split the meson class up.
>>> See the other thread. For some reason, meson always wins
>>> regardless of the inheritance order, so do_configure has
>>> meson_do_configure instead of pep517_do_configure, etc.
>> Add a new do_configure to your class which simply calls the right one.
>
> It still doesn't work. meson_do_qa_configure fails with this: [...]

This construct also doesn't work
===================================
inherit meson
do_configure[postfuncs]:remove = "meson_do_qa_configure"
===================================

It results in an "unparsed line" error. So, I have to re-iterate this:

> Sorry, there seems to be no way around it but splitting out the
> environment setup from meson.bbclass into meson-common class.
> If you don't like the "-common" naming, I can rename it to
> meson-env.bbclass or something like that.
>
> I will still rework python3-meson-python to not require
> the dummy patchelf python module and review other
> comments and make necessary changes.



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-03-23 11:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17  7:25 [meta-python][PATCH v2 1/4] python_mesonpy.bbclass: New class Zoltán Böszörményi
2023-03-17  7:25 ` [meta-python][PATCH v2 2/4] python3-patchelf: New recipe Zoltán Böszörményi
2023-03-20 16:09   ` [oe] " Ross Burton
2023-03-17  7:25 ` [meta-python][PATCH v2 3/4] python3-pyproject-metadata: " Zoltán Böszörményi
2023-03-20 14:45   ` [oe] " Ross Burton
2023-03-17  7:25 ` [meta-python][PATCH v2 4/4] python3-meson-python: " Zoltán Böszörményi
2023-03-20 14:52   ` [oe] " Ross Burton
2023-03-20 14:46 ` [oe] [meta-python][PATCH v2 1/4] python_mesonpy.bbclass: New class Ross Burton
2023-03-20 15:01   ` Böszörményi Zoltán
2023-03-20 16:26     ` Ross Burton
2023-03-22  8:18       ` Böszörményi Zoltán
     [not found]       ` <174EAFE93556A78F.19937@lists.openembedded.org>
2023-03-23 11:18         ` Böszörményi Zoltán

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.