From 10e9785da1a311cec154aba41ad4cf3ca9a9d0ba Mon Sep 17 00:00:00 2001 From: Juan Sanchez Date: Mon, 11 Sep 2023 09:56:09 -0500 Subject: [PATCH] update to matplotlib 3.7.2 (#861) * update to matplotlib 3.7.2 * missing manifest entry for *.cfg --- MANIFEST.in | 2 +- kivy_ios/recipes/matplotlib/__init__.py | 13 +++- kivy_ios/recipes/matplotlib/_tri.cpp.patch | 14 ++-- kivy_ios/recipes/matplotlib/_tri.h.patch | 16 ++--- .../recipes/matplotlib/_tri_wrapper.cpp.patch | 15 ++-- .../{setup.cfg.template => mplsetup.cfg} | 22 +++--- kivy_ios/recipes/matplotlib/setup.py.patch | 52 +++++++------- kivy_ios/recipes/matplotlib/setupext.py.patch | 72 +++++-------------- 8 files changed, 87 insertions(+), 119 deletions(-) rename kivy_ios/recipes/matplotlib/{setup.cfg.template => mplsetup.cfg} (63%) diff --git a/MANIFEST.in b/MANIFEST.in index 92611cf7..d19fff55 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,5 @@ recursive-include kivy_ios *.py -recursive-include kivy_ios/recipes *.py *.patch *.diff *.rst ModulesSetup ModulesSetup.mobile *.m *.h *.pyx *.so *.template +recursive-include kivy_ios/recipes *.py *.patch *.diff *.rst ModulesSetup ModulesSetup.mobile *.m *.h *.pyx *.so *.template *.cfg recursive-include kivy_ios/tools *.py biglink liblink cpplink recursive-include kivy_ios/tools/templates * diff --git a/kivy_ios/recipes/matplotlib/__init__.py b/kivy_ios/recipes/matplotlib/__init__.py index 690c8474..b2d26aca 100644 --- a/kivy_ios/recipes/matplotlib/__init__.py +++ b/kivy_ios/recipes/matplotlib/__init__.py @@ -17,13 +17,14 @@ class MatplotlibRecipe(CythonRecipe): - version = '3.5.2' + version = '3.7.2' url = 'https://github.com/matplotlib/matplotlib/archive/v{version}.zip' library = 'libmatplotlib.a' depends = ['kiwisolver', 'numpy', 'pillow', 'freetype'] pre_build_ext = True python_depends = ['cycler', 'fonttools', 'packaging', - 'pyparsing', 'python-dateutil'] + 'pyparsing', 'python-dateutil', 'six'] + hostpython_prerequisites = ['pybind11', 'certifi'] cythonize = False def generate_libraries_pc_files(self, plat): @@ -71,7 +72,7 @@ def prebuild_platform(self, plat): if self.has_marker("patched"): return shutil.copyfile( - join(abspath(self.recipe_dir), "setup.cfg.template"), + join(abspath(self.recipe_dir), "mplsetup.cfg"), join(self.get_build_dir(plat), "mplsetup.cfg"), ) self.generate_libraries_pc_files(plat) @@ -80,6 +81,12 @@ def prebuild_platform(self, plat): self.apply_patch('_tri_wrapper.cpp.patch') self.apply_patch('setupext.py.patch') self.apply_patch('setup.py.patch') + with open(join(self.get_build_dir(plat), 'lib', 'matplotlib', '_version.py'), 'w') as of: + v1, v2, v3 = self.version.split('.') + of.write(f''' +__version__ = version = '{self.version}' +__version_tuple__ = version_tuple = ({v1}, {v2}, {v3}) +''') self.set_marker("patched") def get_recipe_env(self, plat): diff --git a/kivy_ios/recipes/matplotlib/_tri.cpp.patch b/kivy_ios/recipes/matplotlib/_tri.cpp.patch index 1aa7db01..5ffc71f3 100644 --- a/kivy_ios/recipes/matplotlib/_tri.cpp.patch +++ b/kivy_ios/recipes/matplotlib/_tri.cpp.patch @@ -1,15 +1,15 @@ ---- matplotlib-3.5.2.orig/src/tri/_tri.cpp 2022-05-02 22:49:57 -+++ matplotlib-3.5.2/src/tri/_tri.cpp 2023-09-08 13:17:37 -@@ -13,6 +13,7 @@ - #include +--- matplotlib-3.7.2.orig/src/tri/_tri.cpp 2023-07-05 13:43:01 ++++ matplotlib-3.7.2/src/tri/_tri.cpp 2023-09-10 21:43:21 +@@ -12,6 +12,7 @@ + #include #include +namespace tri { TriEdge::TriEdge() : tri(-1), edge(-1) -@@ -2069,3 +2070,4 @@ - _seed = (_seed*_a + _c) % _m; - return (_seed*max_value) / _m; +@@ -2085,3 +2086,4 @@ + if (upper_right != 0) + upper_right->upper_left = this; } +} diff --git a/kivy_ios/recipes/matplotlib/_tri.h.patch b/kivy_ios/recipes/matplotlib/_tri.h.patch index 1191a2c0..fcc9cbef 100644 --- a/kivy_ios/recipes/matplotlib/_tri.h.patch +++ b/kivy_ios/recipes/matplotlib/_tri.h.patch @@ -1,17 +1,17 @@ ---- matplotlib-3.5.2.orig/src/tri/_tri.h 2022-05-02 22:49:57 -+++ matplotlib-3.5.2/src/tri/_tri.h 2023-09-08 13:17:12 -@@ -72,6 +72,7 @@ - #include +--- matplotlib-3.7.2.orig/src/tri/_tri.h 2023-07-05 13:43:01 ++++ matplotlib-3.7.2/src/tri/_tri.h 2023-09-10 21:43:47 +@@ -74,6 +74,7 @@ + namespace py = pybind11; +namespace tri { /* An edge of a triangle consisting of an triangle index in the range 0 to * ntri-1 and an edge index in the range 0 to 2. Edge i goes from the -@@ -814,5 +815,6 @@ - const unsigned long _m, _a, _c; - unsigned long _seed; +@@ -799,4 +800,6 @@ + Node* _tree; // Root node of the trapezoid map search tree. Owned. }; -+} ++} ++ #endif diff --git a/kivy_ios/recipes/matplotlib/_tri_wrapper.cpp.patch b/kivy_ios/recipes/matplotlib/_tri_wrapper.cpp.patch index 4cd87f61..76a614b8 100644 --- a/kivy_ios/recipes/matplotlib/_tri_wrapper.cpp.patch +++ b/kivy_ios/recipes/matplotlib/_tri_wrapper.cpp.patch @@ -1,12 +1,9 @@ ---- matplotlib-3.5.2.orig/src/tri/_tri_wrapper.cpp 2022-05-02 22:49:57 -+++ matplotlib-3.5.2/src/tri/_tri_wrapper.cpp 2023-09-08 13:23:47 -@@ -1,7 +1,9 @@ +--- matplotlib-3.7.2.orig/src/tri/_tri_wrapper.cpp 2023-07-05 13:43:01 ++++ matplotlib-3.7.2/src/tri/_tri_wrapper.cpp 2023-09-10 21:44:20 +@@ -1,5 +1,6 @@ #include "_tri.h" - #include "../mplutils.h" - #include "../py_exceptions.h" -+ +using namespace tri; - - /* Triangulation */ - + PYBIND11_MODULE(_tri, m) { + py::class_(m, "Triangulation") + .def(py::init=2020.06.20", -- "numpy>=1.17", -+# "numpy>=1.17", - "setuptools_scm>=4", - "setuptools_scm_git_archive", - ], -@@ -323,7 +323,7 @@ +--- matplotlib-3.7.2.orig/setup.py 2023-07-05 13:43:01 ++++ matplotlib-3.7.2/setup.py 2023-09-10 23:56:43 +@@ -322,7 +322,7 @@ "cycler>=0.10", "fonttools>=4.22.0", "kiwisolver>=1.0.1", -- "numpy>=1.17", -+# "numpy>=1.17", +- "numpy>=1.20", ++# "numpy>=1.20", "packaging>=20.0", "pillow>=6.2.0", - "pyparsing>=2.2.1", + "pyparsing>=2.3.1,<3.1", +@@ -339,13 +339,14 @@ + "importlib-resources>=3.2.0", + ], + }, +- use_scm_version={ +- "version_scheme": "release-branch-semver", +- "local_scheme": "node-and-date", +- "write_to": "lib/matplotlib/_version.py", +- "parentdir_prefix_version": "matplotlib-", +- "fallback_version": "0.0+UNKNOWN", +- }, ++ #use_scm_version={ ++ # "version_scheme": "release-branch-semver", ++ # "local_scheme": "node-and-date", ++ # "write_to": "lib/matplotlib/_version.py", ++ # "parentdir_prefix_version": "matplotlib-", ++ # "fallback_version": "3.7.2", ++ #}, ++ version = "3.7.2", + cmdclass={ + "build_ext": BuildExtraLibraries, + "build_py": BuildPy, diff --git a/kivy_ios/recipes/matplotlib/setupext.py.patch b/kivy_ios/recipes/matplotlib/setupext.py.patch index 41bea128..163efe1b 100644 --- a/kivy_ios/recipes/matplotlib/setupext.py.patch +++ b/kivy_ios/recipes/matplotlib/setupext.py.patch @@ -1,15 +1,17 @@ ---- matplotlib-3.5.2.orig/setupext.py 2023-09-08 14:01:18 -+++ matplotlib-3.5.2/setupext.py 2023-09-10 11:29:38 -@@ -404,7 +404,7 @@ - "matplotlib._contour", [ - "src/_contour.cpp", - "src/_contour_wrapper.cpp", -- "src/py_converters.cpp", -+# "src/py_converters.cpp", - ]) - add_numpy_flags(ext) - add_libagg_flags(ext) -@@ -414,7 +414,7 @@ +--- matplotlib-3.7.2.orig/setupext.py 2023-07-05 13:43:01 ++++ matplotlib-3.7.2/setupext.py 2023-09-10 22:52:48 +@@ -17,6 +17,10 @@ + import urllib.request + + from pybind11.setup_helpers import Pybind11Extension ++import pybind11.setup_helpers ++# need to prevent host flags ++pybind11.setup_helpers.MACOS = False ++ + from setuptools import Distribution, Extension + + _log = logging.getLogger(__name__) +@@ -415,7 +419,7 @@ "matplotlib.ft2font", [ "src/ft2font.cpp", "src/ft2font_wrapper.cpp", @@ -18,7 +20,7 @@ ]) FreeType.add_flags(ext) add_numpy_flags(ext) -@@ -424,19 +424,19 @@ +@@ -425,19 +429,19 @@ ext = Extension( "matplotlib._image", [ "src/_image_wrapper.cpp", @@ -42,7 +44,7 @@ yield ext # qhull ext = Extension( -@@ -499,8 +499,8 @@ +@@ -506,8 +510,8 @@ def add_numpy_flags(ext): @@ -53,45 +55,3 @@ ext.define_macros.extend([ # Ensure that PY_ARRAY_UNIQUE_SYMBOL is uniquely defined for each # extension. -@@ -749,22 +749,22 @@ - ext.libraries.extend("m") - - --class BackendMacOSX(OptionalPackage): -- config_category = 'gui_support' -- name = 'macosx' -- -- def check(self): -- if sys.platform != 'darwin': -- raise Skipped("Mac OS-X only") -- return super().check() -- -- def get_extensions(self): -- sources = [ -- 'src/_macosx.m' -- ] -- ext = Extension('matplotlib.backends._macosx', sources) -- ext.extra_compile_args.extend(['-Werror=unguarded-availability']) -- ext.extra_link_args.extend(['-framework', 'Cocoa']) -- if platform.python_implementation().lower() == 'pypy': -- ext.extra_compile_args.append('-DPYPY=1') -- yield ext -+#class BackendMacOSX(OptionalPackage): -+# config_category = 'gui_support' -+# name = 'macosx' -+# -+# def check(self): -+# if sys.platform != 'darwin': -+# raise Skipped("Mac OS-X only") -+# return super().check() -+# -+# def get_extensions(self): -+# sources = [ -+# 'src/_macosx.m' -+# ] -+# ext = Extension('matplotlib.backends._macosx', sources) -+# ext.extra_compile_args.extend(['-Werror=unguarded-availability']) -+# ext.extra_link_args.extend(['-framework', 'Cocoa']) -+# if platform.python_implementation().lower() == 'pypy': -+# ext.extra_compile_args.append('-DPYPY=1') -+# yield ext