Imported Upstream version 2.6.7
[platform/upstream/harfbuzz.git] / src / gen-os2-unicode-ranges.py
index 515f4ca..21aa1b9 100755 (executable)
@@ -1,22 +1,13 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 
-# -*- coding: utf-8 -*-
+"""Generates the code for a sorted unicode range array as used in hb-ot-os2-unicode-ranges.hh
+Input is a tab seperated list of unicode ranges from the otspec
+(https://docs.microsoft.com/en-us/typography/opentype/spec/os2#ur).
+"""
 
-# Generates the code for a sorted unicode range array as used in hb-ot-os2-unicode-ranges.hh
-# Input is a tab seperated list of unicode ranges from the otspec
-# (https://docs.microsoft.com/en-us/typography/opentype/spec/os2#ur).
-
-from __future__ import print_function, division, absolute_import
-
-import io
 import re
 import sys
 
-try:
-  reload(sys)
-  sys.setdefaultencoding('utf-8')
-except NameError:
-  pass  # Python 3
 
 print ("""static OS2Range _hb_os2_unicode_ranges[] =
 {""")
@@ -24,9 +15,9 @@ print ("""static OS2Range _hb_os2_unicode_ranges[] =
 args = sys.argv[1:]
 input_file = args[0]
 
-with io.open(input_file, mode="r", encoding="utf-8") as f:
+with open (input_file, mode="r", encoding="utf-8") as f:
 
-  all_ranges = [];
+  all_ranges = []
   current_bit = 0
   while True:
     line = f.readline().strip()