Skip to content

Commit 7e97411

Browse files
committed
Update matplotlib patch
1 parent 5290b93 commit 7e97411

File tree

1 file changed

+356
-6
lines changed

1 file changed

+356
-6
lines changed

graalpython/lib-graalpython/patches/matplotlib/sdist/matplotlib.patch

Lines changed: 356 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
commit 959e43ded26fc39c0e148af0f64e7e6f31d5f547
2-
Author: Florian Angerer <[email protected]>
3-
Date: Wed Nov 11 14:13:13 2020 +0100
4-
5-
Replace kiwisolver by cassowary
6-
1+
diff --git a/lib/matplotlib.egg-info/requires.txt b/lib/matplotlib.egg-info/requires.txt
2+
index 756f584..134f562 100644
3+
--- a/lib/matplotlib.egg-info/requires.txt
4+
+++ b/lib/matplotlib.egg-info/requires.txt
5+
@@ -1,6 +1,6 @@
6+
certifi>=2020.06.20
7+
cycler>=0.10
8+
-kiwisolver>=1.0.1
9+
+cassowary>=0.5.2
10+
numpy>=1.15
11+
pillow>=6.2.0
12+
pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3
713
diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py
814
index 340eaeb..7d1dfa8 100644
915
--- a/lib/matplotlib/__init__.py
@@ -432,6 +438,29 @@ index 0afa2e4..ea81c7e 100644
432438

433439

434440
def match_width_margins(boxes, levels=1):
441+
diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py
442+
index 14866cc..8ab2629 100644
443+
--- a/lib/matplotlib/image.py
444+
+++ b/lib/matplotlib/image.py
445+
@@ -1545,7 +1545,7 @@ def imsave(fname, arr, vmin=None, vmax=None, cmap=None, format=None,
446+
# Vector formats that are not handled by PIL.
447+
if pil_kwargs is not None:
448+
raise ValueError(
449+
- f"Cannot use 'pil_kwargs' when saving to {format}")
450+
+ "Cannot use 'pil_kwargs' when saving to {}".format(format))
451+
fig = Figure(dpi=dpi, frameon=False)
452+
fig.figimage(arr, cmap=cmap, vmin=vmin, vmax=vmax, origin=origin,
453+
resize=True)
454+
@@ -1583,8 +1583,7 @@ def imsave(fname, arr, vmin=None, vmax=None, cmap=None, format=None,
455+
"'pnginfo' entry in 'pil_kwargs'.")
456+
else:
457+
metadata = {
458+
- "Software": (f"Matplotlib version{mpl.__version__}, "
459+
- f"https://matplotlib.org/"),
460+
+ "Software": ("Matplotlib version{}, https://matplotlib.org/".format(mpl.__version__)),
461+
**(metadata if metadata is not None else {}),
462+
}
463+
pil_kwargs["pnginfo"] = pnginfo = PIL.PngImagePlugin.PngInfo()
435464
diff --git a/setup.py b/setup.py
436465
index 81eae82..80ee5af 100644
437466
--- a/setup.py
@@ -445,6 +474,161 @@ index 81eae82..80ee5af 100644
445474
"numpy>=1.15",
446475
"pillow>=6.2.0",
447476
"pyparsing>=2.0.3,!=2.0.4,!=2.1.2,!=2.1.6",
477+
diff --git a/src/_backend_agg_wrapper.cpp b/src/_backend_agg_wrapper.cpp
478+
index 1377231..f77b95b 100644
479+
--- a/src/_backend_agg_wrapper.cpp
480+
+++ b/src/_backend_agg_wrapper.cpp
481+
@@ -40,7 +40,7 @@ static void PyBufferRegion_dealloc(PyBufferRegion *self)
482+
Py_TYPE(self)->tp_free((PyObject *)self);
483+
}
484+
485+
-static PyObject *PyBufferRegion_to_string(PyBufferRegion *self, PyObject *args, PyObject *kwds)
486+
+static PyObject *PyBufferRegion_to_string(PyBufferRegion *self)
487+
{
488+
return PyBytes_FromStringAndSize((const char *)self->x->get_data(),
489+
self->x->get_height() * self->x->get_stride());
490+
@@ -48,7 +48,7 @@ static PyObject *PyBufferRegion_to_string(PyBufferRegion *self, PyObject *args,
491+
492+
/* TODO: This doesn't seem to be used internally. Remove? */
493+
494+
-static PyObject *PyBufferRegion_set_x(PyBufferRegion *self, PyObject *args, PyObject *kwds)
495+
+static PyObject *PyBufferRegion_set_x(PyBufferRegion *self, PyObject *args)
496+
{
497+
int x;
498+
if (!PyArg_ParseTuple(args, "i:set_x", &x)) {
499+
@@ -59,7 +59,7 @@ static PyObject *PyBufferRegion_set_x(PyBufferRegion *self, PyObject *args, PyOb
500+
Py_RETURN_NONE;
501+
}
502+
503+
-static PyObject *PyBufferRegion_set_y(PyBufferRegion *self, PyObject *args, PyObject *kwds)
504+
+static PyObject *PyBufferRegion_set_y(PyBufferRegion *self, PyObject *args)
505+
{
506+
int y;
507+
if (!PyArg_ParseTuple(args, "i:set_y", &y)) {
508+
@@ -70,14 +70,14 @@ static PyObject *PyBufferRegion_set_y(PyBufferRegion *self, PyObject *args, PyOb
509+
Py_RETURN_NONE;
510+
}
511+
512+
-static PyObject *PyBufferRegion_get_extents(PyBufferRegion *self, PyObject *args, PyObject *kwds)
513+
+static PyObject *PyBufferRegion_get_extents(PyBufferRegion *self)
514+
{
515+
agg::rect_i rect = self->x->get_rect();
516+
517+
return Py_BuildValue("IIII", rect.x1, rect.y1, rect.x2, rect.y2);
518+
}
519+
520+
-static PyObject *PyBufferRegion_to_string_argb(PyBufferRegion *self, PyObject *args, PyObject *kwds)
521+
+static PyObject *PyBufferRegion_to_string_argb(PyBufferRegion *self)
522+
{
523+
PyObject *bufobj;
524+
uint8_t *buf;
525+
@@ -198,7 +198,7 @@ static void PyRendererAgg_dealloc(PyRendererAgg *self)
526+
Py_TYPE(self)->tp_free((PyObject *)self);
527+
}
528+
529+
-static PyObject *PyRendererAgg_draw_path(PyRendererAgg *self, PyObject *args, PyObject *kwds)
530+
+static PyObject *PyRendererAgg_draw_path(PyRendererAgg *self, PyObject *args)
531+
{
532+
GCAgg gc;
533+
py::PathIterator path;
534+
@@ -227,7 +227,7 @@ static PyObject *PyRendererAgg_draw_path(PyRendererAgg *self, PyObject *args, Py
535+
Py_RETURN_NONE;
536+
}
537+
538+
-static PyObject *PyRendererAgg_draw_text_image(PyRendererAgg *self, PyObject *args, PyObject *kwds)
539+
+static PyObject *PyRendererAgg_draw_text_image(PyRendererAgg *self, PyObject *args)
540+
{
541+
numpy::array_view<agg::int8u, 2> image;
542+
double x;
543+
@@ -252,7 +252,7 @@ static PyObject *PyRendererAgg_draw_text_image(PyRendererAgg *self, PyObject *ar
544+
Py_RETURN_NONE;
545+
}
546+
547+
-PyObject *PyRendererAgg_draw_markers(PyRendererAgg *self, PyObject *args, PyObject *kwds)
548+
+PyObject *PyRendererAgg_draw_markers(PyRendererAgg *self, PyObject *args)
549+
{
550+
GCAgg gc;
551+
py::PathIterator marker_path;
552+
@@ -288,7 +288,7 @@ PyObject *PyRendererAgg_draw_markers(PyRendererAgg *self, PyObject *args, PyObje
553+
Py_RETURN_NONE;
554+
}
555+
556+
-static PyObject *PyRendererAgg_draw_image(PyRendererAgg *self, PyObject *args, PyObject *kwds)
557+
+static PyObject *PyRendererAgg_draw_image(PyRendererAgg *self, PyObject *args)
558+
{
559+
GCAgg gc;
560+
double x;
561+
@@ -316,7 +316,7 @@ static PyObject *PyRendererAgg_draw_image(PyRendererAgg *self, PyObject *args, P
562+
}
563+
564+
static PyObject *
565+
-PyRendererAgg_draw_path_collection(PyRendererAgg *self, PyObject *args, PyObject *kwds)
566+
+PyRendererAgg_draw_path_collection(PyRendererAgg *self, PyObject *args)
567+
{
568+
GCAgg gc;
569+
agg::trans_affine master_transform;
570+
@@ -387,7 +387,7 @@ PyRendererAgg_draw_path_collection(PyRendererAgg *self, PyObject *args, PyObject
571+
Py_RETURN_NONE;
572+
}
573+
574+
-static PyObject *PyRendererAgg_draw_quad_mesh(PyRendererAgg *self, PyObject *args, PyObject *kwds)
575+
+static PyObject *PyRendererAgg_draw_quad_mesh(PyRendererAgg *self, PyObject *args)
576+
{
577+
GCAgg gc;
578+
agg::trans_affine master_transform;
579+
@@ -439,7 +439,7 @@ static PyObject *PyRendererAgg_draw_quad_mesh(PyRendererAgg *self, PyObject *arg
580+
}
581+
582+
static PyObject *
583+
-PyRendererAgg_draw_gouraud_triangle(PyRendererAgg *self, PyObject *args, PyObject *kwds)
584+
+PyRendererAgg_draw_gouraud_triangle(PyRendererAgg *self, PyObject *args)
585+
{
586+
GCAgg gc;
587+
numpy::array_view<const double, 2> points;
588+
@@ -480,7 +480,7 @@ PyRendererAgg_draw_gouraud_triangle(PyRendererAgg *self, PyObject *args, PyObjec
589+
}
590+
591+
static PyObject *
592+
-PyRendererAgg_draw_gouraud_triangles(PyRendererAgg *self, PyObject *args, PyObject *kwds)
593+
+PyRendererAgg_draw_gouraud_triangles(PyRendererAgg *self, PyObject *args)
594+
{
595+
GCAgg gc;
596+
numpy::array_view<const double, 3> points;
597+
@@ -527,7 +527,7 @@ PyRendererAgg_draw_gouraud_triangles(PyRendererAgg *self, PyObject *args, PyObje
598+
}
599+
600+
static PyObject *
601+
-PyRendererAgg_get_content_extents(PyRendererAgg *self, PyObject *args, PyObject *kwds)
602+
+PyRendererAgg_get_content_extents(PyRendererAgg *self)
603+
{
604+
agg::rect_i extents;
605+
606+
@@ -561,14 +561,14 @@ int PyRendererAgg_get_buffer(PyRendererAgg *self, Py_buffer *buf, int flags)
607+
return 1;
608+
}
609+
610+
-static PyObject *PyRendererAgg_clear(PyRendererAgg *self, PyObject *args, PyObject *kwds)
611+
+static PyObject *PyRendererAgg_clear(PyRendererAgg *self)
612+
{
613+
CALL_CPP("clear", self->x->clear());
614+
615+
Py_RETURN_NONE;
616+
}
617+
618+
-static PyObject *PyRendererAgg_copy_from_bbox(PyRendererAgg *self, PyObject *args, PyObject *kwds)
619+
+static PyObject *PyRendererAgg_copy_from_bbox(PyRendererAgg *self, PyObject *args)
620+
{
621+
agg::rect_d bbox;
622+
BufferRegion *reg;
623+
@@ -586,7 +586,7 @@ static PyObject *PyRendererAgg_copy_from_bbox(PyRendererAgg *self, PyObject *arg
624+
return regobj;
625+
}
626+
627+
-static PyObject *PyRendererAgg_restore_region(PyRendererAgg *self, PyObject *args, PyObject *kwds)
628+
+static PyObject *PyRendererAgg_restore_region(PyRendererAgg *self, PyObject *args)
629+
{
630+
PyBufferRegion *regobj;
631+
int xx1 = 0, yy1 = 0, xx2 = 0, yy2 = 0, x = 0, y = 0;
448632
diff --git a/src/_path_wrapper.cpp b/src/_path_wrapper.cpp
449633
index 708d7d3..f4484ac 100644
450634
--- a/src/_path_wrapper.cpp
@@ -575,3 +759,169 @@ index 708d7d3..f4484ac 100644
575759
{
576760
py::PathIterator path;
577761
agg::trans_affine trans;
762+
diff --git a/src/ft2font_wrapper.cpp b/src/ft2font_wrapper.cpp
763+
index ba361ac..ab2321c 100644
764+
--- a/src/ft2font_wrapper.cpp
765+
+++ b/src/ft2font_wrapper.cpp
766+
@@ -523,7 +523,7 @@ const char *PyFT2Font_clear__doc__ =
767+
"\n"
768+
"Clear all the glyphs, reset for a new set_text";
769+
770+
-static PyObject *PyFT2Font_clear(PyFT2Font *self, PyObject *args, PyObject *kwds)
771+
+static PyObject *PyFT2Font_clear(PyFT2Font *self)
772+
{
773+
CALL_CPP("clear", (self->x->clear()));
774+
775+
@@ -535,7 +535,7 @@ const char *PyFT2Font_set_size__doc__ =
776+
"\n"
777+
"Set the point size and dpi of the text.\n";
778+
779+
-static PyObject *PyFT2Font_set_size(PyFT2Font *self, PyObject *args, PyObject *kwds)
780+
+static PyObject *PyFT2Font_set_size(PyFT2Font *self, PyObject *args)
781+
{
782+
double ptsize;
783+
double dpi;
784+
@@ -554,7 +554,7 @@ const char *PyFT2Font_set_charmap__doc__ =
785+
"\n"
786+
"Make the i-th charmap current\n";
787+
788+
-static PyObject *PyFT2Font_set_charmap(PyFT2Font *self, PyObject *args, PyObject *kwds)
789+
+static PyObject *PyFT2Font_set_charmap(PyFT2Font *self, PyObject *args)
790+
{
791+
int i;
792+
793+
@@ -572,7 +572,7 @@ const char *PyFT2Font_select_charmap__doc__ =
794+
"\n"
795+
"select charmap i where i is one of the FT_Encoding number\n";
796+
797+
-static PyObject *PyFT2Font_select_charmap(PyFT2Font *self, PyObject *args, PyObject *kwds)
798+
+static PyObject *PyFT2Font_select_charmap(PyFT2Font *self, PyObject *args)
799+
{
800+
unsigned long i;
801+
802+
@@ -594,7 +594,7 @@ const char *PyFT2Font_get_kerning__doc__ =
803+
" KERNING_UNFITTED - Return scaled but un-grid-fitted kerning distances\n"
804+
" KERNING_UNSCALED - Return the kerning vector in original font units\n";
805+
806+
-static PyObject *PyFT2Font_get_kerning(PyFT2Font *self, PyObject *args, PyObject *kwds)
807+
+static PyObject *PyFT2Font_get_kerning(PyFT2Font *self, PyObject *args)
808+
{
809+
FT_UInt left, right, mode;
810+
int result;
811+
@@ -673,7 +673,7 @@ const char *PyFT2Font_get_num_glyphs__doc__ =
812+
"\n"
813+
"Return the number of loaded glyphs\n";
814+
815+
-static PyObject *PyFT2Font_get_num_glyphs(PyFT2Font *self, PyObject *args, PyObject *kwds)
816+
+static PyObject *PyFT2Font_get_num_glyphs(PyFT2Font *self)
817+
{
818+
return PyLong_FromLong(self->x->get_num_glyphs());
819+
}
820+
@@ -761,7 +761,7 @@ const char *PyFT2Font_get_width_height__doc__ =
821+
"The rotation of the string is accounted for. To get width and height\n"
822+
"in pixels, divide these values by 64\n";
823+
824+
-static PyObject *PyFT2Font_get_width_height(PyFT2Font *self, PyObject *args, PyObject *kwds)
825+
+static PyObject *PyFT2Font_get_width_height(PyFT2Font *self)
826+
{
827+
long width, height;
828+
829+
@@ -776,7 +776,7 @@ const char *PyFT2Font_get_bitmap_offset__doc__ =
830+
"Get the offset in 26.6 subpixels for the bitmap if ink hangs left or below (0, 0).\n"
831+
"Since matplotlib only supports left-to-right text, y is always 0.\n";
832+
833+
-static PyObject *PyFT2Font_get_bitmap_offset(PyFT2Font *self, PyObject *args, PyObject *kwds)
834+
+static PyObject *PyFT2Font_get_bitmap_offset(PyFT2Font *self)
835+
{
836+
long x, y;
837+
838+
@@ -792,7 +792,7 @@ const char *PyFT2Font_get_descent__doc__ =
839+
"The rotation of the string is accounted for. To get the descent\n"
840+
"in pixels, divide this value by 64.\n";
841+
842+
-static PyObject *PyFT2Font_get_descent(PyFT2Font *self, PyObject *args, PyObject *kwds)
843+
+static PyObject *PyFT2Font_get_descent(PyFT2Font *self)
844+
{
845+
long descent;
846+
847+
@@ -893,7 +893,7 @@ const char *PyFT2Font_get_glyph_name__doc__ =
848+
"names (per FT_FACE_FLAG_GLYPH_NAMES), this returns a made-up name which \n"
849+
"does *not* roundtrip through `.get_name_index`.\n";
850+
851+
-static PyObject *PyFT2Font_get_glyph_name(PyFT2Font *self, PyObject *args, PyObject *kwds)
852+
+static PyObject *PyFT2Font_get_glyph_name(PyFT2Font *self, PyObject *args)
853+
{
854+
unsigned int glyph_number;
855+
char buffer[128];
856+
@@ -910,7 +910,7 @@ const char *PyFT2Font_get_charmap__doc__ =
857+
"Returns a dictionary that maps the character codes of the selected charmap\n"
858+
"(Unicode by default) to their corresponding glyph indices.\n";
859+
860+
-static PyObject *PyFT2Font_get_charmap(PyFT2Font *self, PyObject *args, PyObject *kwds)
861+
+static PyObject *PyFT2Font_get_charmap(PyFT2Font *self)
862+
{
863+
PyObject *charmap;
864+
if (!(charmap = PyDict_New())) {
865+
@@ -940,7 +940,7 @@ const char *PyFT2Font_get_char_index__doc__ =
866+
"\n"
867+
"Given a character code, returns a glyph index.\n";
868+
869+
-static PyObject *PyFT2Font_get_char_index(PyFT2Font *self, PyObject *args, PyObject *kwds)
870+
+static PyObject *PyFT2Font_get_char_index(PyFT2Font *self, PyObject *args)
871+
{
872+
FT_UInt index;
873+
FT_ULong ccode;
874+
@@ -962,7 +962,7 @@ const char *PyFT2Font_get_sfnt__doc__ =
875+
"key is the platform-ID, ISO-encoding-scheme, language-code, and "
876+
"description.\n";
877+
878+
-static PyObject *PyFT2Font_get_sfnt(PyFT2Font *self, PyObject *args, PyObject *kwds)
879+
+static PyObject *PyFT2Font_get_sfnt(PyFT2Font *self)
880+
{
881+
PyObject *names;
882+
883+
@@ -1022,7 +1022,7 @@ const char *PyFT2Font_get_name_index__doc__ =
884+
"Returns the glyph index of a given glyph name.\n"
885+
"The glyph index 0 means `undefined character code'.\n";
886+
887+
-static PyObject *PyFT2Font_get_name_index(PyFT2Font *self, PyObject *args, PyObject *kwds)
888+
+static PyObject *PyFT2Font_get_name_index(PyFT2Font *self, PyObject *args)
889+
{
890+
char *glyphname;
891+
long name_index;
892+
@@ -1038,7 +1038,7 @@ const char *PyFT2Font_get_ps_font_info__doc__ =
893+
"\n"
894+
"Return the information in the PS Font Info structure.\n";
895+
896+
-static PyObject *PyFT2Font_get_ps_font_info(PyFT2Font *self, PyObject *args, PyObject *kwds)
897+
+static PyObject *PyFT2Font_get_ps_font_info(PyFT2Font *self)
898+
{
899+
PS_FontInfoRec fontinfo;
900+
901+
@@ -1066,7 +1066,7 @@ const char *PyFT2Font_get_sfnt_table__doc__ =
902+
"Return one of the following SFNT tables: head, maxp, OS/2, hhea, "
903+
"vhea, post, or pclt.\n";
904+
905+
-static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObject *kwds)
906+
+static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args)
907+
{
908+
char *tagname;
909+
if (!PyArg_ParseTuple(args, "s:get_sfnt_table", &tagname)) {
910+
@@ -1368,7 +1368,7 @@ const char *PyFT2Font_get_path__doc__ =
911+
"Get the path data from the currently loaded glyph as a tuple of vertices, "
912+
"codes.\n";
913+
914+
-static PyObject *PyFT2Font_get_path(PyFT2Font *self, PyObject *args, PyObject *kwds)
915+
+static PyObject *PyFT2Font_get_path(PyFT2Font *self)
916+
{
917+
int count;
918+
919+
@@ -1390,7 +1390,7 @@ const char *PyFT2Font_get_image__doc__ =
920+
"\n"
921+
"Returns the underlying image buffer for this font object.\n";
922+
923+
-static PyObject *PyFT2Font_get_image(PyFT2Font *self, PyObject *args, PyObject *kwds)
924+
+static PyObject *PyFT2Font_get_image(PyFT2Font *self)
925+
{
926+
FT2Image &im = self->x->get_image();
927+
npy_intp dims[] = {(npy_intp)im.get_height(), (npy_intp)im.get_width() };

0 commit comments

Comments
 (0)