Merge pull request 'only accept eval/build for nix command' (#2030) from Mic92-type-checking into main
This commit is contained in:
@@ -45,7 +45,7 @@ def list_possible_keymaps() -> list[str]:
|
|||||||
|
|
||||||
if not keymaps_dir.exists():
|
if not keymaps_dir.exists():
|
||||||
msg = f"Keymaps directory '{keymaps_dir}' does not exist."
|
msg = f"Keymaps directory '{keymaps_dir}' does not exist."
|
||||||
raise FileNotFoundError(msg)
|
raise ClanError(msg)
|
||||||
|
|
||||||
keymap_files = []
|
keymap_files = []
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ def list_possible_languages() -> list[str]:
|
|||||||
|
|
||||||
if not locale_file.exists():
|
if not locale_file.exists():
|
||||||
msg = f"Locale file '{locale_file}' does not exist."
|
msg = f"Locale file '{locale_file}' does not exist."
|
||||||
raise FileNotFoundError(msg)
|
raise ClanError(msg)
|
||||||
|
|
||||||
with locale_file.open() as f:
|
with locale_file.open() as f:
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ class Machine:
|
|||||||
|
|
||||||
def nix(
|
def nix(
|
||||||
self,
|
self,
|
||||||
method: str,
|
method: Literal["eval", "build"],
|
||||||
attr: str,
|
attr: str,
|
||||||
extra_config: None | dict = None,
|
extra_config: None | dict = None,
|
||||||
impure: bool = False,
|
impure: bool = False,
|
||||||
@@ -217,11 +217,7 @@ class Machine:
|
|||||||
if method == "eval":
|
if method == "eval":
|
||||||
output = run_no_stdout(nix_eval(args)).stdout.strip()
|
output = run_no_stdout(nix_eval(args)).stdout.strip()
|
||||||
return output
|
return output
|
||||||
if method == "build":
|
return Path(run_no_stdout(nix_build(args)).stdout.strip())
|
||||||
outpath = run_no_stdout(nix_build(args)).stdout.strip()
|
|
||||||
return Path(outpath)
|
|
||||||
msg = f"Unknown method {method}"
|
|
||||||
raise ValueError(msg)
|
|
||||||
|
|
||||||
def eval_nix(
|
def eval_nix(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user