Skip to main content

Module utils

Module utils 

Source
Expand description

Common utility functions — color-aware output, command existence checks, print helpers.

Ports functionality from scripts/common_utils.sh:

  • Color constants that auto-disable for non-TTY and NO_COLOR
  • command_exists() utility function
  • Print helpers (header, section, step, success, warning, error)

§Validation Assertions

  • VAL-INFRA-016: Color-aware output auto-disabling for non-TTY, command_exists utility

Structs§

Colors
ANSI color constants that auto-disable for non-TTY and NO_COLOR.

Enums§

PipCacheFixResult
Result of fixing pip cache directory ownership.
PythonPkgManager
Detected Python package manager.

Functions§

color_enabled
Determine if color output should be used.
command_exists
Check if a command exists in the system PATH.
detect_python_pkg_manager
Detect the available Python package manager.
execute_command
Execute a command with dry-run support.
fix_pip_cache_ownership
Fix ownership of the pip cache directory (~/.cache/pip).
get_colors
Get the appropriate color constants based on terminal capabilities.
pip_install_prefix
Build a pip install command prefix using the detected package manager.
print_error
Print an error message to stderr.
print_header
Print a formatted header box to stderr.
print_section
Print a section separator to stderr.
print_step
Print a step indicator to stderr.
print_success
Print a success message to stderr.
print_warning
Print a warning message to stderr.
resolve_rocminfo_path
Resolve the full path to the rocminfo binary.
resolve_rocprofiler_tool_path
Resolve the path to the ROCm rocprofiler SDK tool library.