new file mode 100644
@@ -0,0 +1,45 @@
+From b19715aeafcf8440466553d01717924add1eabf4 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 9 Apr 2025 23:17:12 -0700
+Subject: [PATCH] Change types for width/height to match definitions in
+ BufferRegion
+
+This is found with clang
+
+Fixes
+../matplotlib-3.10.1/src/_backend_agg_wrapper.cpp:253:17: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'int' in initializer list [-Wc++11-narrowing]
+
+Upstream-Status: Submitted [https://github.com/matplotlib/matplotlib/pull/29894]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/_backend_agg.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/_backend_agg.h b/src/_backend_agg.h
+index 0e33d38dfd..dcbd7e1496 100644
+--- a/src/_backend_agg.h
++++ b/src/_backend_agg.h
+@@ -131,12 +131,12 @@ class RendererAgg
+
+ virtual ~RendererAgg();
+
+- unsigned int get_width()
++ int get_width()
+ {
+ return width;
+ }
+
+- unsigned int get_height()
++ int get_height()
+ {
+ return height;
+ }
+@@ -206,7 +206,7 @@ class RendererAgg
+ void restore_region(BufferRegion ®);
+ void restore_region(BufferRegion ®ion, int xx1, int yy1, int xx2, int yy2, int x, int y);
+
+- unsigned int width, height;
++ int width, height;
+ double dpi;
+ size_t NUMBYTES; // the number of bytes in buffer
+
new file mode 100644
@@ -0,0 +1,47 @@
+From a6b0bc129de493f57bf79005c48a8d4ca0df68c2 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 9 Apr 2025 17:34:55 -0700
+Subject: [PATCH] Do not download external dependency tarballs via meson
+
+They are fetched by bitbake fetcher already
+
+Upstream-Status: Inappropriate [ OE-Specific ]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ subprojects/freetype-2.6.1.wrap | 7 +------
+ subprojects/qhull.wrap | 9 ++-------
+ 2 files changed, 3 insertions(+), 13 deletions(-)
+
+diff --git a/subprojects/freetype-2.6.1.wrap b/subprojects/freetype-2.6.1.wrap
+index 763362b..74ecb13 100644
+--- a/subprojects/freetype-2.6.1.wrap
++++ b/subprojects/freetype-2.6.1.wrap
+@@ -1,10 +1,5 @@
+ [wrap-file]
+-source_url = https://download.savannah.gnu.org/releases/freetype/freetype-old/freetype-2.6.1.tar.gz
+-source_fallback_url = https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz
+-source_filename = freetype-2.6.1.tar.gz
+-source_hash = 0a3c7dfbda6da1e8fce29232e8e96d987ababbbf71ebc8c75659e4132c367014
+-
+-patch_directory = freetype-2.6.1-meson
++directory = freetype-2.6.1
+
+ [provide]
+ freetype-2.6.1 = freetype_dep
+diff --git a/subprojects/qhull.wrap b/subprojects/qhull.wrap
+index c52b07d..30b6904 100644
+--- a/subprojects/qhull.wrap
++++ b/subprojects/qhull.wrap
+@@ -1,9 +1,4 @@
+ [wrap-file]
+-# Also bump the cache key in `.circleci/config.yml`.
+-# Also update the docs in `docs/devel/dependencies.rst`.
+-directory = qhull-8.0.2
+-source_url = https://github.com/qhull/qhull/archive/v8.0.2/qhull-8.0.2.tar.gz
+-source_filename = qhull-8.0.2.tgz
+-source_hash = 8774e9a12c70b0180b95d6b0b563c5aa4bea8d5960c15e18ae3b6d2521d64f8b
++directory = qhull-2020.2
+
+-patch_directory = qhull-8.0.2
++patch_directory = qhull-2020.2
deleted file mode 100644
@@ -1,75 +0,0 @@
-Disable automatic downloading of components!
-
-Upstream-Status: Inappropriate [disable feature]
-
-Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
-
-Update patch to fit on 3.7.2.
-
-Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
-
-diff --git a/setup.py b/setup.py
-index 0bea13fa6f..f39d8fc871 100644
---- a/setup.py
-+++ b/setup.py
-@@ -327,13 +327,7 @@ setup( # Finally, pass this all along to setuptools to do the heavy lifting.
- "pillow>=6.2.0",
- "pyparsing>=2.3.1,<3.1",
- "python-dateutil>=2.7",
-- ] + (
-- # Installing from a git checkout that is not producing a wheel.
-- ["setuptools_scm>=7"] if (
-- Path(__file__).with_name(".git").exists() and
-- os.environ.get("CIBUILDWHEEL", "0") != "1"
-- ) else []
-- ),
-+ ],
- extras_require={
- ':python_version<"3.10"': [
- "importlib-resources>=3.2.0",
-diff --git a/setupext.py b/setupext.py
-index a898d642d6..474172ff8f 100644
---- a/setupext.py
-+++ b/setupext.py
-@@ -66,40 +66,7 @@ def get_from_cache_or_download(url, sha):
- BytesIO
- The file loaded into memory.
- """
-- cache_dir = _get_xdg_cache_dir()
--
-- if cache_dir is not None: # Try to read from cache.
-- try:
-- data = (cache_dir / sha).read_bytes()
-- except IOError:
-- pass
-- else:
-- if _get_hash(data) == sha:
-- return BytesIO(data)
--
-- # jQueryUI's website blocks direct downloads from urllib.request's
-- # default User-Agent, but not (for example) wget; so I don't feel too
-- # bad passing in an empty User-Agent.
-- with urllib.request.urlopen(
-- urllib.request.Request(url, headers={"User-Agent": ""}),
-- context=_get_ssl_context()) as req:
-- data = req.read()
--
-- file_sha = _get_hash(data)
-- if file_sha != sha:
-- raise Exception(
-- f"The downloaded file does not match the expected sha. {url} was "
-- f"expected to have {sha} but it had {file_sha}")
--
-- if cache_dir is not None: # Try to cache the downloaded file.
-- try:
-- cache_dir.mkdir(parents=True, exist_ok=True)
-- with open(cache_dir / sha, "xb") as fout:
-- fout.write(data)
-- except IOError:
-- pass
--
-- return BytesIO(data)
-+ raise IOError(f"Automatic downloading is disabled.")
-
-
- def get_and_extract_tarball(urls, sha, dirname):
new file mode 100644
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+pytest --automake --pyargs matplotlib
new file mode 100644
@@ -0,0 +1,49 @@
+SUMMARY = "matplotlib: plotting with Python"
+DESCRIPTION = "\
+Matplotlib is a Python 2D plotting library which produces \
+publication-quality figures in a variety of hardcopy formats \
+and interactive environments across platforms."
+HOMEPAGE = "https://github.com/matplotlib/matplotlib"
+SECTION = "devel/python"
+LICENSE = "PSF-2.0"
+LIC_FILES_CHKSUM = "\
+ file://LICENSE/LICENSE;md5=afec61498aa5f0c45936687da9a53d74 \
+"
+
+DEPENDS = "\
+ freetype \
+ libpng \
+ python3-pybind11 \
+ qhull \
+"
+
+SRC_URI += "file://run-ptest \
+ file://0001-Do-not-download-external-dependency-tarballs-via-mes.patch \
+ file://0001-Change-types-for-width-height-to-match-definitions-i.patch \
+ "
+SRC_URI[sha256sum] = "e8d2d0e3881b129268585bf4765ad3ee73a4591d77b9a18c214ac7e3a79fb2ba"
+
+inherit pypi pkgconfig python3targetconfig meson ptest-python-pytest
+
+EXTRA_OEMESON += "-Dsystem-freetype=true -Dsystem-qhull=true"
+
+# LTO with clang needs lld
+LDFLAGS:append:toolchain-clang = " -fuse-ld=lld"
+
+FILES:${PN}-ptest += "${PYTHON_SITEPACKAGES_DIR}/matplotlib/tests"
+FILES:${PN} += "${PYTHON_SITEPACKAGES_DIR}/"
+
+RDEPENDS:${PN} = "\
+ freetype \
+ libpng \
+ python3-numpy \
+ python3-pyparsing \
+ python3-cycler \
+ python3-dateutil \
+ python3-kiwisolver \
+ python3-pytz \
+ python3-pillow \
+ python3-packaging \
+"
+
+BBCLASSEXTEND = "native"
deleted file mode 100644
@@ -1,70 +0,0 @@
-SUMMARY = "matplotlib: plotting with Python"
-DESCRIPTION = "\
-Matplotlib is a Python 2D plotting library which produces \
-publication-quality figures in a variety of hardcopy formats \
-and interactive environments across platforms."
-HOMEPAGE = "https://github.com/matplotlib/matplotlib"
-SECTION = "devel/python"
-LICENSE = "PSF-2.0"
-LIC_FILES_CHKSUM = "\
- file://setup.py;beginline=293;endline=293;md5=20e7ab4d2b2b1395a0e4ab800181eb96 \
- file://LICENSE/LICENSE;md5=afec61498aa5f0c45936687da9a53d74 \
-"
-
-DEPENDS = "\
- freetype \
- libpng \
- python3-numpy-native \
- python3-pip-native \
- python3-dateutil-native \
- python3-pytz-native \
- python3-certifi-native \
- python3-setuptools-scm-native \
- python3-pybind11-native \
-"
-SRC_URI[sha256sum] = "a8cdb91dddb04436bd2f098b8fdf4b81352e68cf4d2c6756fcc414791076569b"
-
-inherit pypi setuptools3 pkgconfig
-
-# Stop the component from attempting to download when it detects a missing
-# dependency
-SRC_URI += "file://matplotlib-disable-download.patch \
-"
-
-# This python module requires a full copy of freetype-2.6.1
-SRC_URI += "https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz;name=freetype;subdir=matplotlib-${PV}/build"
-SRC_URI[freetype.sha256sum] = "0a3c7dfbda6da1e8fce29232e8e96d987ababbbf71ebc8c75659e4132c367014"
-
-# This python module requires a full copy of 'qhull-2020'
-SRC_URI += "http://www.qhull.org/download/qhull-2020-src-8.0.2.tgz;name=qhull;subdir=matplotlib-${PV}/build"
-SRC_URI[qhull.sha256sum] = "b5c2d7eb833278881b952c8a52d20179eab87766b00b865000469a45c1838b7e"
-
-# LTO with clang needs lld
-LDFLAGS:append:toolchain-clang = " -fuse-ld=lld"
-LDFLAGS:remove:toolchain-clang:mips = "-fuse-ld=lld"
-LDFLAGS:remove:toolchain-clang:riscv64 = "-fuse-ld=lld"
-LDFLAGS:remove:toolchain-clang:riscv32 = "-fuse-ld=lld"
-RDEPENDS:${PN} = "\
- freetype \
- libpng \
- python3-numpy \
- python3-pyparsing \
- python3-cycler \
- python3-dateutil \
- python3-kiwisolver \
- python3-pytz \
- python3-pillow \
- python3-packaging \
-"
-
-ENABLELTO:toolchain-clang:riscv64 = "echo enable_lto = False >> ${S}/mplsetup.cfg"
-ENABLELTO:toolchain-clang:riscv32 = "echo enable_lto = False >> ${S}/mplsetup.cfg"
-ENABLELTO:toolchain-clang:mips = "echo enable_lto = False >> ${S}/mplsetup.cfg"
-
-do_compile:prepend() {
- echo [libs] > ${S}/mplsetup.cfg
- echo system_freetype = True >> ${S}/mplsetup.cfg
- ${ENABLELTO}
-}
-
-BBCLASSEXTEND = "native"
- Adjust for move to meson build system. - Use system freetype and qhull - Add ptest insfrastructure, they do not pass yet - Add a patch to fix build on 32bit machines Signed-off-by: Khem Raj <raj.khem@gmail.com> Cc: Trevor Gamblin <tgamblin@baylibre.com> --- ...-width-height-to-match-definitions-i.patch | 45 +++++++++++ ...external-dependency-tarballs-via-mes.patch | 47 ++++++++++++ .../matplotlib-disable-download.patch | 75 ------------------- .../python/python3-matplotlib/run-ptest | 3 + .../python/python3-matplotlib_3.10.1.bb | 49 ++++++++++++ .../python/python3-matplotlib_3.7.2.bb | 70 ----------------- 6 files changed, 144 insertions(+), 145 deletions(-) create mode 100644 meta-python/recipes-devtools/python/python3-matplotlib/0001-Change-types-for-width-height-to-match-definitions-i.patch create mode 100644 meta-python/recipes-devtools/python/python3-matplotlib/0001-Do-not-download-external-dependency-tarballs-via-mes.patch delete mode 100644 meta-python/recipes-devtools/python/python3-matplotlib/matplotlib-disable-download.patch create mode 100644 meta-python/recipes-devtools/python/python3-matplotlib/run-ptest create mode 100644 meta-python/recipes-devtools/python/python3-matplotlib_3.10.1.bb delete mode 100644 meta-python/recipes-devtools/python/python3-matplotlib_3.7.2.bb