Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 239ed51

Browse filesBrowse files
committed
BLD: Fix setting FreeType build type in extension
Previously, this used a macro defined on the command line to a literal, which was "stringified" with macro magic. But if the command-line definition isn't there, then you just get a stringified version of the macro name. Instead, don't do any stringification, so that it fails on error. Then pass a string as the defnition.
1 parent 112a225 commit 239ed51
Copy full SHA for 239ed51

File tree

Expand file treeCollapse file tree

3 files changed

+15
-11
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+15
-11
lines changed

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+9-7Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,13 +1315,15 @@ def _init_tests():
13151315
if (ft2font.__freetype_version__ != LOCAL_FREETYPE_VERSION or
13161316
ft2font.__freetype_build_type__ != 'local'):
13171317
_log.warning(
1318-
f"Matplotlib is not built with the correct FreeType version to "
1319-
f"run tests. Rebuild without setting system-freetype=true in "
1320-
f"Meson setup options. Expect many image comparison failures below. "
1321-
f"Expected freetype version {LOCAL_FREETYPE_VERSION}. "
1322-
f"Found freetype version {ft2font.__freetype_version__}. "
1323-
"Freetype build type is {}local".format(
1324-
"" if ft2font.__freetype_build_type__ == 'local' else "not "))
1318+
"Matplotlib is not built with the correct FreeType version to run tests. "
1319+
"Rebuild without setting system-freetype=true in Meson setup options. "
1320+
"Expect many image comparison failures below. "
1321+
"Expected freetype version %s. "
1322+
"Found freetype version %s. "
1323+
"Freetype build type is %slocal.",
1324+
LOCAL_FREETYPE_VERSION,
1325+
ft2font.__freetype_version__,
1326+
"" if ft2font.__freetype_build_type__ == 'local' else "not ")
13251327

13261328

13271329
def _replacer(data, value):

‎src/ft2font_wrapper.cpp

Copy file name to clipboardExpand all lines: src/ft2font_wrapper.cpp
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
#include <set>
1111
#include <algorithm>
1212

13-
#define STRINGIFY(s) XSTRINGIFY(s)
14-
#define XSTRINGIFY(s) #s
15-
1613
static PyObject *convert_xys_to_array(std::vector<double> &xys)
1714
{
1815
npy_intp dims[] = {(npy_intp)xys.size() / 2, 2 };
@@ -1532,7 +1529,7 @@ PyMODINIT_FUNC PyInit_ft2font(void)
15321529
// Glyph is not constructible from Python, thus not added to the module.
15331530
PyType_Ready(PyGlyph_init_type()) ||
15341531
PyModule_AddStringConstant(m, "__freetype_version__", version_string) ||
1535-
PyModule_AddStringConstant(m, "__freetype_build_type__", STRINGIFY(FREETYPE_BUILD_TYPE)) ||
1532+
PyModule_AddStringConstant(m, "__freetype_build_type__", FREETYPE_BUILD_TYPE) ||
15361533
PyModule_AddIntConstant(m, "SCALABLE", FT_FACE_FLAG_SCALABLE) ||
15371534
PyModule_AddIntConstant(m, "FIXED_SIZES", FT_FACE_FLAG_FIXED_SIZES) ||
15381535
PyModule_AddIntConstant(m, "FIXED_WIDTH", FT_FACE_FLAG_FIXED_WIDTH) ||

‎src/meson.build

Copy file name to clipboardExpand all lines: src/meson.build
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ extension_data = {
9696
'dependencies': [
9797
freetype_dep, numpy_dep, agg_dep.partial_dependency(includes: true),
9898
],
99+
'cpp_args': [
100+
'-DFREETYPE_BUILD_TYPE="@0@"'.format(
101+
freetype_dep.type_name() == 'internal' ? 'local' : 'system',
102+
),
103+
],
99104
},
100105
'_image': {
101106
'subdir': 'matplotlib',

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.