Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 47a4870

Browse files
committed
Move local freetype building resp. to freetypy
1 parent 315a30c commit 47a4870

File tree

5 files changed

+7
-41
lines changed

5 files changed

+7
-41
lines changed

lib/matplotlib/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,11 +1503,11 @@ def _init_tests():
15031503
# tests. This must match the value in `setupext.py`
15041504
LOCAL_FREETYPE_VERSION = '2.6.1'
15051505

1506-
from matplotlib import ft2font
1507-
if (ft2font.__freetype_version__ != LOCAL_FREETYPE_VERSION or
1508-
ft2font.__freetype_build_type__ != 'local'):
1506+
import freetypy as ft
1507+
if (ft.__freetype_version__ != LOCAL_FREETYPE_VERSION or
1508+
ft.__freetype_build_type__ != 'local'):
15091509
warnings.warn(
1510-
"matplotlib is not built with the correct FreeType version to run "
1510+
"freetypy is not built with the correct FreeType version to run "
15111511
"tests. Set local_freetype=True in setup.cfg and rebuild. "
15121512
"Expect many image comparison failures below.")
15131513

lib/matplotlib/font_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import numpy as np
1616

17-
from matplotlib import ceil
17+
from math import ceil
1818

1919

2020
def draw_glyph_to_bitmap(image, x, y, glyph):

lib/matplotlib/testing/decorators.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import nose
1515
import numpy as np
16+
import freetypy as ft
1617

1718
import matplotlib as mpl
1819
import matplotlib.style
@@ -123,8 +124,6 @@ def wrapped_function(*args, **kwargs):
123124

124125

125126
def check_freetype_version(ver):
126-
import freetypy as ft
127-
128127
if ver is None:
129128
return True
130129

@@ -224,7 +223,7 @@ def do_test():
224223
if not check_freetype_version(self._freetype_version):
225224
raise KnownFailureTest(
226225
"Mismatched version of freetype. Test requires '%s', you have '%s'" %
227-
(self._freetype_version, ft2font.__freetype_version__))
226+
(self._freetype_version, ft.__freetype_version__))
228227
raise
229228

230229
yield (do_test,)

setup.cfg.template

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88
# This can be a single directory or a comma-delimited list of directories.
99
#basedirlist = /usr
1010

11-
[test]
12-
# If you plan to develop matplotlib and run or add to the test suite,
13-
# set this to True. It will download and build a specific version of
14-
# FreeType, and then use that to build the ft2font extension. This
15-
# ensures that test images are exactly reproducible.
16-
#local_freetype = False
17-
1811
[status]
1912
# To suppress display of the dependencies and their versions
2013
# at the top of the build log, uncomment the following line:

setupext.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from distutils import version
55
from distutils.core import Extension
66
import glob
7-
import io
87
import multiprocessing
98
import os
109
import re
@@ -20,13 +19,6 @@
2019
PY3 = (sys.version_info[0] >= 3)
2120

2221

23-
# This is the version of FreeType to use when building a local
24-
# version. It must match the value in
25-
# lib/matplotlib.__init__.py
26-
LOCAL_FREETYPE_VERSION = '2.6.1'
27-
# md5 hash of the freetype tarball
28-
LOCAL_FREETYPE_HASH = '348e667d728c597360e4a87c16556597'
29-
3022
if sys.platform != 'win32':
3123
if sys.version_info[0] < 3:
3224
from commands import getstatusoutput
@@ -64,9 +56,6 @@
6456
options['basedirlist'] = [
6557
x.strip() for x in
6658
config.get("directories", "basedirlist").split(',')]
67-
68-
if config.has_option('test', 'local_freetype'):
69-
options['local_freetype'] = config.get("test", "local_freetype")
7059
else:
7160
config = None
7261

@@ -223,21 +212,6 @@ def make_extension(name, files, *args, **kwargs):
223212
return ext
224213

225214

226-
def get_file_hash(filename):
227-
"""
228-
Get the MD5 hash of a given filename.
229-
"""
230-
import hashlib
231-
BLOCKSIZE = 1 << 16
232-
hasher = hashlib.md5()
233-
with open(filename, 'rb') as fd:
234-
buf = fd.read(BLOCKSIZE)
235-
while len(buf) > 0:
236-
hasher.update(buf)
237-
buf = fd.read(BLOCKSIZE)
238-
return hasher.hexdigest()
239-
240-
241215
class PkgConfig(object):
242216
"""
243217
This is a class for communicating with pkg-config.

0 commit comments

Comments
 (0)