Skip to content

Commit

Permalink
Add --additional-flags argument (#50)
Browse files Browse the repository at this point in the history
So we can use it in typeshed to disable bytearray/memoryview promotions
  • Loading branch information
JelleZijlstra authored Nov 9, 2022
1 parent 893b19f commit ceecd71
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ The hardcoded list is in theory susceptible to bitrot, but if you pass e.g. the
usage: mypy_primer [-h] [--new NEW] [--old OLD] [--repo REPO]
[--mypyc-compile-level MYPYC_COMPILE_LEVEL]
[--custom-typeshed-repo CUSTOM_TYPESHED_REPO] [--new-typeshed NEW_TYPESHED]
[--old-typeshed OLD_TYPESHED] [-k PROJECT_SELECTOR] [-p LOCAL_PROJECT]
[--expected-success] [--project-date PROJECT_DATE] [--num-shards NUM_SHARDS]
[--old-typeshed OLD_TYPESHED] [--additional-flags [ADDITIONAL_FLAGS ...]]
[-k PROJECT_SELECTOR] [-p LOCAL_PROJECT] [--expected-success]
[--project-date PROJECT_DATE] [--num-shards NUM_SHARDS]
[--shard-index SHARD_INDEX] [-o {full,diff,concise}] [--old-success]
[--coverage] [--bisect] [--bisect-output BISECT_OUTPUT] [-j CONCURRENCY]
[--debug] [--base-dir BASE_DIR] [--clear]
optional arguments:
options:
-h, --help show this help message and exit
mypy:
Expand All @@ -58,6 +59,8 @@ mypy:
--old-typeshed OLD_TYPESHED
old typeshed version, defaults to mypy's (anything commit-ish, or
isoformatted date)
--additional-flags [ADDITIONAL_FLAGS ...]
additional flags to pass to mypy
project selection:
-k PROJECT_SELECTOR, --project-selector PROJECT_SELECTOR
Expand Down
8 changes: 7 additions & 1 deletion mypy_primer.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def get_mypy_cmd(self, mypy: str | Path, additional_flags: Sequence[str] = ()) -
return mypy_cmd

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

Expand Down Expand Up @@ -809,6 +809,12 @@ def parse_options(argv: list[str]) -> argparse.Namespace:
"--old-typeshed",
help="old typeshed version, defaults to mypy's (anything commit-ish, or isoformatted date)",
)
mypy_group.add_argument(
"--additional-flags",
help="additional flags to pass to mypy",
nargs="*",
default=[],
)

proj_group = parser.add_argument_group("project selection")
proj_group.add_argument(
Expand Down

0 comments on commit ceecd71

Please sign in to comment.