You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ms...@apache.org on 2020/01/28 14:42:30 UTC
[openoffice] 08/08: gtest patch to allow building with Python 3.
This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit d12e9282201a631f4e41c9c584d98b1f338e38d9
Author: Damjan Jovanovic <da...@apache.org>
AuthorDate: Sat Jan 25 02:59:46 2020 +0200
gtest patch to allow building with Python 3.
Patch by: me
(cherry picked from commit aec63fa3669010e9bec513e6cd55a25fc335d90e)
---
ext_libraries/gtest/gtest-python3.patch | 96 +++++++++++++++++++++++++++++++++
ext_libraries/gtest/makefile.mk | 2 +-
2 files changed, 97 insertions(+), 1 deletion(-)
diff --git a/ext_libraries/gtest/gtest-python3.patch b/ext_libraries/gtest/gtest-python3.patch
new file mode 100644
index 0000000..54e7d6f
--- /dev/null
+++ b/ext_libraries/gtest/gtest-python3.patch
@@ -0,0 +1,96 @@
+--- misc/build/gtest-1.7.0/scripts/fuse_gtest_files.py 2020-01-25 02:36:23.509596000 +0200
++++ misc/build/gtest-1.7.0/scripts/fuse_gtest_files.py 2020-01-25 02:50:02.624028000 +0200
+@@ -60,7 +60,10 @@
+
+ import os
+ import re
+-import sets
++try:
++ import sets
++except ImportError:
++ pass
+ import sys
+
+ # We assume that this file is in the scripts/ directory in the Google
+@@ -90,8 +93,8 @@
+ """
+
+ if not os.path.isfile(os.path.join(directory, relative_path)):
+- print 'ERROR: Cannot find %s in directory %s.' % (relative_path,
+- directory)
++ print ('ERROR: Cannot find %s in directory %s.' % (relative_path,
++ directory))
+ print ('Please either specify a valid project root directory '
+ 'or omit it on the command line.')
+ sys.exit(1)
+@@ -123,7 +126,7 @@
+ (relative_path, output_dir))
+ answer = sys.stdin.readline().strip()
+ if answer not in ['y', 'Y']:
+- print 'ABORTED.'
++ print ('ABORTED.')
+ sys.exit(1)
+
+ # Makes sure the directory holding the output file exists; creates
+@@ -146,8 +149,11 @@
+ def FuseGTestH(gtest_root, output_dir):
+ """Scans folder gtest_root to generate gtest/gtest.h in output_dir."""
+
+- output_file = file(os.path.join(output_dir, GTEST_H_OUTPUT), 'w')
+- processed_files = sets.Set() # Holds all gtest headers we've processed.
++ output_file = open(os.path.join(output_dir, GTEST_H_OUTPUT), 'w')
++ if sys.version_info[0] > 2:
++ processed_files = set()
++ else:
++ processed_files = sets.Set() # Holds all gtest headers we've processed.
+
+ def ProcessFile(gtest_header_path):
+ """Processes the given gtest header file."""
+@@ -159,7 +165,7 @@
+ processed_files.add(gtest_header_path)
+
+ # Reads each line in the given gtest header.
+- for line in file(os.path.join(gtest_root, gtest_header_path), 'r'):
++ for line in open(os.path.join(gtest_root, gtest_header_path), 'r'):
+ m = INCLUDE_GTEST_FILE_REGEX.match(line)
+ if m:
+ # It's '#include "gtest/..."' - let's process it recursively.
+@@ -175,7 +181,10 @@
+ def FuseGTestAllCcToFile(gtest_root, output_file):
+ """Scans folder gtest_root to generate gtest/gtest-all.cc in output_file."""
+
+- processed_files = sets.Set()
++ if sys.version_info[0] > 2:
++ processed_files = set()
++ else:
++ processed_files = sets.Set()
+
+ def ProcessFile(gtest_source_file):
+ """Processes the given gtest source file."""
+@@ -187,7 +196,7 @@
+ processed_files.add(gtest_source_file)
+
+ # Reads each line in the given gtest source file.
+- for line in file(os.path.join(gtest_root, gtest_source_file), 'r'):
++ for line in open(os.path.join(gtest_root, gtest_source_file), 'r'):
+ m = INCLUDE_GTEST_FILE_REGEX.match(line)
+ if m:
+ if 'include/' + m.group(1) == GTEST_SPI_H_SEED:
+@@ -218,7 +227,7 @@
+ def FuseGTestAllCc(gtest_root, output_dir):
+ """Scans folder gtest_root to generate gtest/gtest-all.cc in output_dir."""
+
+- output_file = file(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w')
++ output_file = open(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w')
+ FuseGTestAllCcToFile(gtest_root, output_file)
+ output_file.close()
+
+@@ -242,7 +251,7 @@
+ # fuse_gtest_files.py GTEST_ROOT_DIR OUTPUT_DIR
+ FuseGTest(sys.argv[1], sys.argv[2])
+ else:
+- print __doc__
++ print (__doc__)
+ sys.exit(1)
+
+
diff --git a/ext_libraries/gtest/makefile.mk b/ext_libraries/gtest/makefile.mk
index 0b811e5..4c0b1c4 100644
--- a/ext_libraries/gtest/makefile.mk
+++ b/ext_libraries/gtest/makefile.mk
@@ -46,7 +46,7 @@ TARFILE_NAME=$(PRJNAME)-$(LIBGTESTVERSION)
# thankfully, does not care.
TARFILE_MD5=2d6ec8ccdf5c46b05ba54a9fd1d130d7
-PATCH_FILES= use-own-tuple.patch
+PATCH_FILES= use-own-tuple.patch gtest-python3.patch
.IF "$(OS)"=="WNT"