1--- misc/build/gtest-1.7.0/scripts/fuse_gtest_files.py	2020-01-25 02:36:23.509596000 +0200
2+++ misc/build/gtest-1.7.0/scripts/fuse_gtest_files.py	2020-01-25 02:50:02.624028000 +0200
3@@ -60,7 +60,10 @@
4
5 import os
6 import re
7-import sets
8+try:
9+    import sets
10+except ImportError:
11+    pass
12 import sys
13
14 # We assume that this file is in the scripts/ directory in the Google
15@@ -90,8 +93,8 @@
16   """
17
18   if not os.path.isfile(os.path.join(directory, relative_path)):
19-    print 'ERROR: Cannot find %s in directory %s.' % (relative_path,
20-                                                      directory)
21+    print ('ERROR: Cannot find %s in directory %s.' % (relative_path,
22+                                                      directory))
23     print ('Please either specify a valid project root directory '
24            'or omit it on the command line.')
25     sys.exit(1)
26@@ -123,7 +126,7 @@
27            (relative_path, output_dir))
28     answer = sys.stdin.readline().strip()
29     if answer not in ['y', 'Y']:
30-      print 'ABORTED.'
31+      print ('ABORTED.')
32       sys.exit(1)
33
34   # Makes sure the directory holding the output file exists; creates
35@@ -146,8 +149,11 @@
36 def FuseGTestH(gtest_root, output_dir):
37   """Scans folder gtest_root to generate gtest/gtest.h in output_dir."""
38
39-  output_file = file(os.path.join(output_dir, GTEST_H_OUTPUT), 'w')
40-  processed_files = sets.Set()  # Holds all gtest headers we've processed.
41+  output_file = open(os.path.join(output_dir, GTEST_H_OUTPUT), 'w')
42+  if sys.version_info[0] > 2:
43+      processed_files = set()
44+  else:
45+      processed_files = sets.Set()  # Holds all gtest headers we've processed.
46
47   def ProcessFile(gtest_header_path):
48     """Processes the given gtest header file."""
49@@ -159,7 +165,7 @@
50     processed_files.add(gtest_header_path)
51
52     # Reads each line in the given gtest header.
53-    for line in file(os.path.join(gtest_root, gtest_header_path), 'r'):
54+    for line in open(os.path.join(gtest_root, gtest_header_path), 'r'):
55       m = INCLUDE_GTEST_FILE_REGEX.match(line)
56       if m:
57         # It's '#include "gtest/..."' - let's process it recursively.
58@@ -175,7 +181,10 @@
59 def FuseGTestAllCcToFile(gtest_root, output_file):
60   """Scans folder gtest_root to generate gtest/gtest-all.cc in output_file."""
61
62-  processed_files = sets.Set()
63+  if sys.version_info[0] > 2:
64+      processed_files = set()
65+  else:
66+      processed_files = sets.Set()
67
68   def ProcessFile(gtest_source_file):
69     """Processes the given gtest source file."""
70@@ -187,7 +196,7 @@
71     processed_files.add(gtest_source_file)
72
73     # Reads each line in the given gtest source file.
74-    for line in file(os.path.join(gtest_root, gtest_source_file), 'r'):
75+    for line in open(os.path.join(gtest_root, gtest_source_file), 'r'):
76       m = INCLUDE_GTEST_FILE_REGEX.match(line)
77       if m:
78         if 'include/' + m.group(1) == GTEST_SPI_H_SEED:
79@@ -218,7 +227,7 @@
80 def FuseGTestAllCc(gtest_root, output_dir):
81   """Scans folder gtest_root to generate gtest/gtest-all.cc in output_dir."""
82
83-  output_file = file(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w')
84+  output_file = open(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w')
85   FuseGTestAllCcToFile(gtest_root, output_file)
86   output_file.close()
87
88@@ -242,7 +251,7 @@
89     # fuse_gtest_files.py GTEST_ROOT_DIR OUTPUT_DIR
90     FuseGTest(sys.argv[1], sys.argv[2])
91   else:
92-    print __doc__
93+    print (__doc__)
94     sys.exit(1)
95
96
97