[buildUCD] make MetaTools script not depend on fontTools
Removed fontTools imports to prevent bootstrapping issues for downstream package maintainers that wish to run buildUCD.py at build time (i.e. when fontTools is not installed yet).
This commit is contained in:
parent
0be50c922c
commit
464f9821be
@ -5,7 +5,6 @@ Tools to parse data files from the Unicode Character Database.
|
||||
|
||||
from __future__ import print_function, absolute_import, division
|
||||
from __future__ import unicode_literals
|
||||
from fontTools.misc.py23 import *
|
||||
|
||||
try:
|
||||
from urllib.request import urlopen
|
||||
@ -16,9 +15,16 @@ import re
|
||||
from codecs import iterdecode
|
||||
import logging
|
||||
import os
|
||||
from io import open
|
||||
from os.path import abspath, dirname, join as pjoin, pardir, sep
|
||||
|
||||
|
||||
try: # pragma: no cover
|
||||
unicode
|
||||
except NameError:
|
||||
unicode = str
|
||||
|
||||
|
||||
UNIDATA_URL = "https://unicode.org/Public/UNIDATA/"
|
||||
UNIDATA_LICENSE_URL = "http://unicode.org/copyright.html#License"
|
||||
|
||||
@ -83,14 +89,14 @@ def parse_range_properties(infile, default=None, is_set=False):
|
||||
|
||||
first = int(first, 16)
|
||||
last = int(last, 16)
|
||||
data = tostr(data.rstrip(), encoding="ascii")
|
||||
data = str(data.rstrip())
|
||||
|
||||
ranges.append((first, last, data))
|
||||
|
||||
ranges.sort()
|
||||
|
||||
if isinstance(default, unicode):
|
||||
default = tostr(default, encoding="ascii")
|
||||
default = str(default)
|
||||
|
||||
# fill the gaps between explicitly defined ranges
|
||||
last_start, last_end = -1, -1
|
||||
|
Loading…
x
Reference in New Issue
Block a user