avl_bin

avl_bin#

Locates, verifies, and invokes the AVL Fortran binary via subprocess.

Locate the AVL binary, verify it, and drive it via stdin command script.

avl_aero_tables.avl_bin.find_avl()[source]#

Return the path to the AVL binary.

Checks ~/bin/avl first (documented install location), then falls back to anything named avl* on PATH.

Example

>>> from avl_aero_tables.avl_bin import find_avl
>>> binary = find_avl()
>>> binary.name
'avl'
Return type:

Path

avl_aero_tables.avl_bin.run(command_text, binary=None, cwd=None)[source]#

Feed command_text to AVL via stdin and return the completed process.

Set cwd to the directory containing the .avl file so that AVL’s ‘LOAD <name>’ resolves correctly.

Example

>>> from pathlib import Path
>>> from avl_aero_tables.avl_bin import find_avl, run
>>> binary = find_avl()
>>> result = run("LOAD bd\nQuit\n", cwd=Path("examples"))
>>> result.returncode
0
Parameters:
  • command_text (str)

  • binary (Path | None)

  • cwd (Path | None)

Return type:

CompletedProcess[str]

avl_aero_tables.avl_bin.run_file(command_file, binary=None, cwd=None)[source]#

Read command_file and feed it to AVL via stdin.

Example

>>> import tempfile
>>> from pathlib import Path
>>> from avl_aero_tables.avl_bin import run_file
>>> with tempfile.NamedTemporaryFile(mode="w", suffix=".txt", delete=False) as f:
...     _ = f.write("LOAD bd\nQuit\n")
...     cmd_path = Path(f.name)
>>> result = run_file(cmd_path, cwd=Path("examples"))
>>> result.returncode
0
Parameters:
  • command_file (Path)

  • binary (Path | None)

  • cwd (Path | None)

Return type:

CompletedProcess[str]

avl_aero_tables.avl_bin.verify(binary=None)[source]#

Verify that the AVL binary launches successfully and return its path.

Example

>>> from avl_aero_tables.avl_bin import verify
>>> binary = verify()
>>> binary.is_file()
True
Parameters:

binary (Path | None)

Return type:

Path