Skip to content

Commit 83d5d66

Browse files
authored
Patching over some rot
* Remove unnecessary global statement * Stop building Antlr tests because of cmake compatibility * Work around warnings from 'fs' (imported by fonttools)
1 parent 3b78bea commit 83d5d66

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

cmake/ExternalAntlr4Cpp.cmake

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ endif()
1515
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
1616
set(ANTLR4_OUTPUT_DIR ${ANTLR4_ROOT}/runtime/Cpp/runtime/$(Configuration))
1717
elseif(${CMAKE_GENERATOR} MATCHES "Xcode.*")
18-
set(ANTLR4_OUTPUT_DIR ${ANTLR4_ROOT}/runtime/Cpp/dist/$(CONFIGURATION))
18+
set(ANTLR4_OUTPUT_DIR ${ANTLR4_ROOT}/runtime/Cpp/runtime)
1919
else()
20-
set(ANTLR4_OUTPUT_DIR ${ANTLR4_ROOT}/runtime/Cpp/dist)
20+
set(ANTLR4_OUTPUT_DIR ${ANTLR4_ROOT}/runtime/Cpp/runtime)
2121
endif()
2222

2323
if(MSVC)
@@ -90,6 +90,8 @@ if(ANTLR4_ZIP_REPOSITORY)
9090
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
9191
-DWITH_STATIC_CRT:BOOL=${ANTLR4_WITH_STATIC_CRT}
9292
-DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}
93+
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
94+
-DANTLR_BUILD_CPP_TESTS:BOOL=OFF
9395
# -DCMAKE_CXX_STANDARD:STRING=17 # if desired, compile the runtime with a different C++ standard
9496
# -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} # alternatively, compile the runtime with the same C++ standard as the outer project
9597
INSTALL_COMMAND ""
@@ -109,6 +111,8 @@ else()
109111
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
110112
-DWITH_STATIC_CRT:BOOL=${ANTLR4_WITH_STATIC_CRT}
111113
-DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}
114+
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
115+
-DANTLR_BUILD_CPP_TESTS:BOOL=OFF
112116
# -DCMAKE_CXX_STANDARD:STRING=17 # if desired, compile the runtime with a different C++ standard
113117
# -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} # alternatively, compile the runtime with the same C++ standard as the outer project
114118
INSTALL_COMMAND ""

python/afdko/pdflib/pdfmetrics.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ class FontCache:
353353
"""Loads and caches font width information on demand. Font names
354354
converted to lower case for indexing. Public interface is stringwidth"""
355355
def __init__(self):
356-
global FONT_WIDTHS
357356
self.__widtharrays = FONT_WIDTHS
358357

359358
def loadfont(self, fontname):

tests/makeotf_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ def test_build_font_and_check_messages(args, ttx_fname):
144144
expected_msg_path = get_expected_path(f'{ttx_fname}_output.txt')
145145
ttx_filename = f'{ttx_fname}.ttx'
146146
stderr_path = runner(CMD + [
147-
'-s', '-e', '-o', 'f', f'_{get_input_path("font.pfa")}',
148-
'o', f'_{actual_path}'] + args)
147+
'-s', '-e', '-n', '-o', 'f', f'_{get_input_path("font.pfa")}',
148+
'o', f'_{actual_path}'] + args)
149149
actual_ttx = generate_ttx_dump(actual_path)
150150
expected_ttx = get_expected_path(ttx_filename)
151151
assert differ([expected_ttx, actual_ttx,
@@ -654,7 +654,7 @@ def test_duplicate_warning_messages_bug751():
654654
otf_path = get_temp_file_path()
655655

656656
stderr_path = runner(
657-
CMD + ['-s', '-e', '-o',
657+
CMD + ['-s', '-e', '-n', '-o',
658658
'f', f'_{get_input_path(input_filename)}',
659659
'o', f'_{otf_path}'])
660660

@@ -688,7 +688,7 @@ def test_cli_numerics():
688688
expected_msg_path = get_expected_path("clinum_output.txt")
689689
out_font_path = get_temp_file_path()
690690
stderr_path = runner(CMD + [
691-
'-s', '-e', '-o',
691+
'-s', '-e', '-n', '-o',
692692
'f', f'_{get_input_path(input_filename)}',
693693
'o', f'_{out_font_path}',
694694
'fi', f'_{get_input_path(fontinfo_filename)}'])

tests/runner.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ def run_tool(opts):
8888
if opts.std_error:
8989
stderr = subprocess.STDOUT
9090

91+
sp_env = os.environ.copy()
92+
if opts.no_python_warn:
93+
sp_env['PYTHONWARNINGS'] = 'ignore'
94+
9195
if allow_skip_console and console_scripts.get(opts.tool):
9296
mod, fcn = console_scripts[opts.tool].split(':')
9397
args[0] = sys.executable
@@ -100,11 +104,11 @@ def run_tool(opts):
100104
try:
101105
if opts.save_path:
102106
output = subprocess.check_output(args, stderr=stderr,
103-
timeout=TIMEOUT)
107+
timeout=TIMEOUT, env=sp_env)
104108
_write_file(opts.save_path, output)
105109
return opts.save_path
106110
else:
107-
return subprocess.check_call(args, timeout=TIMEOUT)
111+
return subprocess.check_call(args, timeout=TIMEOUT, env=sp_env)
108112
except (subprocess.CalledProcessError, OSError) as err:
109113
if opts.save_path:
110114
_write_file(opts.save_path, err.output)
@@ -225,6 +229,12 @@ def get_options(args):
225229
action='store_true',
226230
help="capture stderr instead of stdout"
227231
)
232+
parser.add_argument(
233+
'-n',
234+
'--no-python-warn',
235+
action='store_true',
236+
help="Suppress python warnings"
237+
)
228238
options = parser.parse_args(args)
229239

230240
if not options.verbose:

0 commit comments

Comments
 (0)