Merge pull request #3509 from fonttools/ttx-gnu-getopt

[ttx] use GNU-style getopt to intermix options and positional arguments
This commit is contained in:
Cosimo Lupo 2024-05-17 12:19:49 +01:00 committed by GitHub
commit b2b771076c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -375,7 +375,7 @@ def guessFileType(fileName):
def parseOptions(args):
rawOptions, files = getopt.getopt(
rawOptions, files = getopt.gnu_getopt(
args,
"ld:o:fvqht:x:sgim:z:baey:",
[

View File

@ -1018,6 +1018,15 @@ def test_main_ttx_compile_stdin_to_stdout(tmp_path):
assert outpath.is_file()
def test_main_gnu_style_opts_and_args_intermixed(tmpdir):
# https://github.com/fonttools/fonttools/issues/3507
inpath = os.path.join("Tests", "ttx", "data", "TestTTF.ttf")
outpath = tmpdir.join("TestTTF.ttx")
args = ["-t", "cmap", inpath, "-o", str(outpath)]
ttx.main(args)
assert outpath.check(file=True)
def test_roundtrip_DSIG_split_at_XML_parse_buffer_size(tmp_path):
inpath = Path("Tests").joinpath(
"ttx", "data", "roundtrip_DSIG_split_at_XML_parse_buffer_size.ttx"