Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to matplotlib 3.7.2 #861

Merged
merged 2 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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 *

Expand Down
13 changes: 10 additions & 3 deletions kivy_ios/recipes/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand All @@ -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):
Expand Down
14 changes: 7 additions & 7 deletions kivy_ios/recipes/matplotlib/_tri.cpp.patch
Original file line number Diff line number Diff line change
@@ -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 <algorithm>
--- 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 <random>
#include <set>

+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;
}
+}
16 changes: 8 additions & 8 deletions kivy_ios/recipes/matplotlib/_tri.h.patch
Original file line number Diff line number Diff line change
@@ -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 <vector>
--- 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
15 changes: 6 additions & 9 deletions kivy_ios/recipes/matplotlib/_tri_wrapper.cpp.patch
Original file line number Diff line number Diff line change
@@ -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_<Triangulation>(m, "Triangulation")
.def(py::init<const Triangulation::CoordinateArray&,
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@
[libs]
# By default, Matplotlib builds with LTO, which may be slow if you re-compile
# often, and don't need the space saving/speedup.
#
enable_lto = False
#
# By default, Matplotlib downloads and builds its own copies of FreeType and of
# Qhull. You may set the following to True to instead link against a system
# FreeType/Qhull. As an exception, Matplotlib defaults to the system version
# of FreeType on AIX.
#
system_freetype = True
#system_qhull = False

[packages]
# There are a number of data subpackages from Matplotlib that are
# considered optional. All except 'tests' data (meaning the baseline
# image files) are installed by default, but that can be changed here.
#tests = False

[gui_support]
# Matplotlib supports multiple GUI toolkits, known as backends.
# The MacOSX backend requires the Cocoa headers included with XCode.
# You can select whether to build it by uncommenting the following line.
# It is never built on Linux or Windows, regardless of the config value.
# Some of Matplotlib's components are optional: the MacOSX backend (installed
# by default on MacOSX; requires the Cocoa headers included with XCode), and
# the test data (i.e., the baseline image files; not installed by default).
# You can control whether they are installed by uncommenting the following
# lines. Note that the MacOSX backend is never built on Linux or Windows,
# regardless of the config value.
#
tests = False
macosx = False

[rc_options]
Expand All @@ -35,4 +35,4 @@ macosx = False
# not choose MacOSX if you have disabled the relevant extension modules. The
# default is determined by fallback.
#
#backend = Agg
#backend = Agg
52 changes: 28 additions & 24 deletions kivy_ios/recipes/matplotlib/setup.py.patch
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
--- matplotlib-3.5.2.orig/setup.py 2022-05-02 22:49:57
+++ matplotlib-3.5.2/setup.py 2023-09-10 11:11:57
@@ -47,7 +47,7 @@
setupext.FreeType(),
setupext.Qhull(),
setupext.Tests(),
- setupext.BackendMacOSX(),
+# setupext.BackendMacOSX(),
]


@@ -315,7 +315,7 @@
python_requires='>={}'.format('.'.join(str(n) for n in py_min_version)),
setup_requires=[
"certifi>=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,
72 changes: 16 additions & 56 deletions kivy_ios/recipes/matplotlib/setupext.py.patch
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand All @@ -42,7 +44,7 @@
yield ext
# qhull
ext = Extension(
@@ -499,8 +499,8 @@
@@ -506,8 +510,8 @@


def add_numpy_flags(ext):
Expand All @@ -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
Loading