Skip to content

Commit ceecd71

Browse files
Add --additional-flags argument (#50)
So we can use it in typeshed to disable bytearray/memoryview promotions
1 parent 893b19f commit ceecd71

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ The hardcoded list is in theory susceptible to bitrot, but if you pass e.g. the
3232
usage: mypy_primer [-h] [--new NEW] [--old OLD] [--repo REPO]
3333
[--mypyc-compile-level MYPYC_COMPILE_LEVEL]
3434
[--custom-typeshed-repo CUSTOM_TYPESHED_REPO] [--new-typeshed NEW_TYPESHED]
35-
[--old-typeshed OLD_TYPESHED] [-k PROJECT_SELECTOR] [-p LOCAL_PROJECT]
36-
[--expected-success] [--project-date PROJECT_DATE] [--num-shards NUM_SHARDS]
35+
[--old-typeshed OLD_TYPESHED] [--additional-flags [ADDITIONAL_FLAGS ...]]
36+
[-k PROJECT_SELECTOR] [-p LOCAL_PROJECT] [--expected-success]
37+
[--project-date PROJECT_DATE] [--num-shards NUM_SHARDS]
3738
[--shard-index SHARD_INDEX] [-o {full,diff,concise}] [--old-success]
3839
[--coverage] [--bisect] [--bisect-output BISECT_OUTPUT] [-j CONCURRENCY]
3940
[--debug] [--base-dir BASE_DIR] [--clear]
4041
41-
optional arguments:
42+
options:
4243
-h, --help show this help message and exit
4344
4445
mypy:
@@ -58,6 +59,8 @@ mypy:
5859
--old-typeshed OLD_TYPESHED
5960
old typeshed version, defaults to mypy's (anything commit-ish, or
6061
isoformatted date)
62+
--additional-flags [ADDITIONAL_FLAGS ...]
63+
additional flags to pass to mypy
6164
6265
project selection:
6366
-k PROJECT_SELECTOR, --project-selector PROJECT_SELECTOR

mypy_primer.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def get_mypy_cmd(self, mypy: str | Path, additional_flags: Sequence[str] = ()) -
366366
return mypy_cmd
367367

368368
async def run_mypy(self, mypy: str | Path, typeshed_dir: Path | None) -> MypyResult:
369-
additional_flags = []
369+
additional_flags = list(ARGS.additional_flags)
370370
env = os.environ.copy()
371371
env["MYPY_FORCE_COLOR"] = "1"
372372

@@ -809,6 +809,12 @@ def parse_options(argv: list[str]) -> argparse.Namespace:
809809
"--old-typeshed",
810810
help="old typeshed version, defaults to mypy's (anything commit-ish, or isoformatted date)",
811811
)
812+
mypy_group.add_argument(
813+
"--additional-flags",
814+
help="additional flags to pass to mypy",
815+
nargs="*",
816+
default=[],
817+
)
812818

813819
proj_group = parser.add_argument_group("project selection")
814820
proj_group.add_argument(

0 commit comments

Comments
 (0)