Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 7, 2024
1 parent 925c763 commit df9094f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion doc/manual/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ nix_eval_for_docs_common = nix_for_docs + [
nix_eval_for_docs = nix_eval_for_docs_common + '--raw'

conf_file_json = custom_target(
command : nix_for_docs + ['show-config', '--json'],
command : nix_for_docs + ['show', 'config', '--json'],
capture : true,
output : 'conf-file.json',
env : nix_env_for_docs,
Expand Down
4 changes: 2 additions & 2 deletions doc/manual/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ mkMesonDerivation (finalAttrs: {
'';

postInstall = ''
mkdir -p ''${!outputDoc}/nix-support
echo "doc manual ''${!outputDoc}/share/doc/nix/manual" >> ''${!outputDoc}/nix-support/hydra-build-products
mkdir -p ''$out/nix-support
echo "doc manual ''$out/share/doc/nix/manual" >> ''$out/nix-support/hydra-build-products
'';

meta = {
Expand Down
13 changes: 6 additions & 7 deletions doc/manual/substitute.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

name = 'substitute.py'

def log(*args, **kwargs):
def log(*args: Any, **kwargs: Any) -> None:
kwargs['file'] = sys.stderr
return print(f'{name}:', *args, **kwargs)
print(f'{name}:', *args, **kwargs)

def do_include(content: str, relative_md_path: Path, source_root: Path, search_path: Path):
def do_include(content: str, relative_md_path: Path, source_root: Path, search_path: Path) -> str:
assert not relative_md_path.is_absolute(), f'{relative_md_path=} from mdbook should be relative'

md_path_abs = source_root / relative_md_path
Expand All @@ -34,7 +34,7 @@ def do_include(content: str, relative_md_path: Path, source_root: Path, search_p
lines.append(l)
return "".join(lines)

def recursive_replace(data, book_root, search_path):
def recursive_replace(data: dict[str, Any], book_root: Path, search_path: Path) -> dict[str, Any]:
match data:
case {'sections': sections}:
return data | dict(
Expand Down Expand Up @@ -67,9 +67,8 @@ def recursive_replace(data, book_root, search_path):
case rest:
assert False, f'should have been called on a dict, not {type(rest)=}\n\t{rest=}'

def main():
def main() -> None:

print(f'{name}: HIIIIII', file=sys.stderr)

if len(sys.argv) > 1 and sys.argv[1] == 'supports':
return 0
Expand Down Expand Up @@ -106,6 +105,6 @@ def main():
try:
sys.exit(main())
except AssertionError as e:
print(f'{name}: INTERNAL ERROR in mdbook preprocessor', file=sys.stderr)
print(f'{name}: INTERNAL ERROR in mdbook preprocessor: {e}', file=sys.stderr)
print(f'this is a bug in {name}', file=sys.stderr)
raise

0 comments on commit df9094f

Please sign in to comment.