3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-07 18:05:21 +00:00

Merge pull request #2064 from varming/cv/utf8

Specify UTF-8 encoding in python scripts
This commit is contained in:
Nikolaj Bjorner 2019-01-06 12:58:37 +08:00 committed by GitHub
commit ed4223af94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -8,6 +8,7 @@
# You should **not** import ``mk_util`` here
# to avoid having this code depend on the
# of the Python build system.
import io
import os
import pprint
import logging
@ -622,7 +623,7 @@ def mk_gparams_register_modules_internal(h_files_full_path, path):
reg_mod_descr_pat = re.compile('[ \t]*REG_MODULE_DESCRIPTION\(\'([^\']*)\', *\'([^\']*)\'\)')
for h_file in sorted_headers_by_component(h_files_full_path):
added_include = False
with open(h_file, 'r') as fin:
with io.open(h_file, encoding='utf-8', mode='r') as fin:
for line in fin:
m = reg_pat.match(line)
if m:
@ -696,7 +697,7 @@ def mk_install_tactic_cpp_internal(h_files_full_path, path):
for h_file in sorted_headers_by_component(h_files_full_path):
added_include = False
try:
with open(h_file, 'r') as fin:
with io.open(h_file, encoding='utf-8', mode='r') as fin:
for line in fin:
if tactic_pat.match(line):
if not added_include:
@ -764,7 +765,7 @@ def mk_mem_initializer_cpp_internal(h_files_full_path, path):
finalizer_pat = re.compile('[ \t]*ADD_FINALIZER\(\'([^\']*)\'\)')
for h_file in sorted_headers_by_component(h_files_full_path):
added_include = False
with open(h_file, 'r') as fin:
with io.open(h_file, encoding='utf-8', mode='r') as fin:
for line in fin:
m = initializer_pat.match(line)
if m:

View file

@ -6,6 +6,7 @@
#
# Author: Leonardo de Moura (leonardo)
############################################
import io
import sys
import os
import re
@ -806,7 +807,7 @@ def extract_c_includes(fname):
# We should generate and error for any occurrence of #include that does not match the previous pattern.
non_std_inc_pat = re.compile(".*#include.*")
f = open(fname, 'r')
f = io.open(fname, encoding='utf-8', mode='r')
linenum = 1
for line in f:
m1 = std_inc_pat.match(line)