docs: Make the Python scripts Python 2&3 compatible

This commit is contained in:
Roland Dobai
2018-09-07 13:46:50 +02:00
parent 27d1b04500
commit f5a642840a
6 changed files with 48 additions and 29 deletions

View File

@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import unicode_literals
from io import open
import re
import os
import shutil
@@ -25,10 +27,10 @@ def files_equal(path_1, path_2):
if not os.path.exists(path_1) or not os.path.exists(path_2):
return False
file_1_contents = ''
with open(path_1, "r") as f_1:
with open(path_1, "r", encoding='utf-8') as f_1:
file_1_contents = f_1.read()
file_2_contents = ''
with open(path_2, "r") as f_2:
with open(path_2, "r", encoding='utf-8') as f_2:
file_2_contents = f_2.read()
return file_1_contents == file_2_contents