diff options
author | Greg Price <gnprice@gmail.com> | 2019-08-15 01:18:53 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2019-08-15 01:18:53 (GMT) |
commit | 3e4498d35c34aeaf4a9c3d57509b0d3277048ac6 (patch) | |
tree | a01f3f8ec7f2385174997240418572f38d1aaf2c | |
parent | 68e495df909a33e719e3f1ef5b4893ec785e10a4 (diff) | |
download | cpython-3e4498d35c34aeaf4a9c3d57509b0d3277048ac6.zip cpython-3e4498d35c34aeaf4a9c3d57509b0d3277048ac6.tar.gz cpython-3e4498d35c34aeaf4a9c3d57509b0d3277048ac6.tar.bz2 |
bpo-37760: Avoid cluttering work tree with downloaded Unicode files. (GH-15128)
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Tools/unicode/makeunicodedata.py | 7 |
2 files changed, 6 insertions, 2 deletions
@@ -74,6 +74,7 @@ PCbuild/arm32/ PCbuild/arm64/ PCbuild/obj/ PCbuild/win32/ +Tools/unicode/data/ .purify __pycache__ autom4te.cache diff --git a/Tools/unicode/makeunicodedata.py b/Tools/unicode/makeunicodedata.py index cc2b298..464a4eb 100644 --- a/Tools/unicode/makeunicodedata.py +++ b/Tools/unicode/makeunicodedata.py @@ -887,15 +887,18 @@ def merge_old_version(version, new, old): normalization_changes)) +DATA_DIR = os.path.join('Tools', 'unicode', 'data') + def open_data(template, version): - local = template % ('-'+version,) + local = os.path.join(DATA_DIR, template % ('-'+version,)) if not os.path.exists(local): import urllib.request if version == '3.2.0': # irregular url structure - url = 'http://www.unicode.org/Public/3.2-Update/' + local + url = ('http://www.unicode.org/Public/3.2-Update/'+template) % ('-'+version,) else: url = ('http://www.unicode.org/Public/%s/ucd/'+template) % (version, '') + os.makedirs(DATA_DIR, exist_ok=True) urllib.request.urlretrieve(url, filename=local) if local.endswith('.txt'): return open(local, encoding='utf-8') |