|
11 | 11 | import time
|
12 | 12 |
|
13 | 13 | from dataclasses import dataclass
|
14 |
| -from pathlib import Path |
15 | 14 | from typing import TYPE_CHECKING
|
16 | 15 |
|
17 | 16 | import subprocess_tee
|
18 | 17 | import yaml
|
19 | 18 |
|
20 | 19 |
|
21 | 20 | if TYPE_CHECKING:
|
| 21 | + from pathlib import Path |
22 | 22 | from types import TracebackType
|
23 | 23 |
|
24 | 24 | from .config import Config
|
@@ -280,25 +280,15 @@ def collect_manifests( # noqa: C901
|
280 | 280 | def builder_introspect(config: Config, output: Output) -> None:
|
281 | 281 | """Introspect a collection.
|
282 | 282 |
|
283 |
| - Default to the path of ansible-builder adjacent to the python executable. |
284 |
| - Since ansible-builder is a dependency of ade, it should be in the same bin directory |
285 |
| - as the python interpreter that spawned the ade process. |
286 |
| - If not found, we cannot introspect. |
| 283 | + Use the sys executable to run builder, since it is a direct dependency |
| 284 | + it should be accessible to the current interpreter. |
287 | 285 |
|
288 | 286 | Args:
|
289 | 287 | config: The configuration object.
|
290 | 288 | output: The output object.
|
291 | 289 | """
|
292 |
| - builder_path = Path(sys.executable).parent / "ansible-builder" |
293 |
| - if not builder_path.exists(): |
294 |
| - output.critical( |
295 |
| - "Failed to find ansible-builder. Please check the installation" |
296 |
| - " of ade as it should have been installed by default.", |
297 |
| - ) |
298 |
| - return # pragma: no cover |
299 |
| - |
300 | 290 | command = (
|
301 |
| - f"{builder_path} introspect {config.site_pkg_path}" |
| 291 | + f"{sys.executable} -m ansible_builder introspect {config.site_pkg_path}" |
302 | 292 | f" --write-pip {config.discovered_python_reqs}"
|
303 | 293 | f" --write-bindep {config.discovered_bindep_reqs}"
|
304 | 294 | " --sanitize"
|
@@ -329,7 +319,7 @@ def builder_introspect(config: Config, output: Output) -> None:
|
329 | 319 | )
|
330 | 320 | except subprocess.CalledProcessError as exc:
|
331 | 321 | err = f"Failed to discover requirements: {exc} {exc.stderr}"
|
332 |
| - logger.critical(err) |
| 322 | + output.critical(err) |
333 | 323 |
|
334 | 324 | if not config.discovered_python_reqs.exists():
|
335 | 325 | config.discovered_python_reqs.touch()
|
|
0 commit comments