Skip to content

Commit

Permalink
Add some logging to help troubleshoot
Browse files Browse the repository at this point in the history
  • Loading branch information
vkottler committed Oct 2, 2023
1 parent 03704f7 commit 5ad4b10
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
10 changes: 9 additions & 1 deletion yambs/commands/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# built-in
from argparse import ArgumentParser as _ArgumentParser
from argparse import Namespace as _Namespace
from logging import getLogger
from pathlib import Path as _Path
from shutil import which
from subprocess import run
Expand All @@ -15,9 +16,16 @@
from rcmpy.watch.params import WatchParams

# internal
from yambs import PKG_NAME
from yambs import DESCRIPTION, PKG_NAME, VERSION
from yambs.config.common import DEFAULT_CONFIG

LOG = getLogger(__name__)


def log_package() -> None:
"""Log some basic package information."""
LOG.info("%s-%s - %s.", PKG_NAME, VERSION, DESCRIPTION)


def add_config_arg(parser: _ArgumentParser) -> None:
"""Add an argument for specifying a configuration file."""
Expand Down
5 changes: 5 additions & 0 deletions yambs/commands/compile_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
from vcorelib.dict import MergeStrategy, merge_dicts
from vcorelib.io import ARBITER, DEFAULT_INCLUDES_KEY

# internal
from yambs.commands.common import log_package


def compile_config_cmd(args: _Namespace) -> int:
"""Execute the compile_config command."""
Expand All @@ -20,6 +23,8 @@ def compile_config_cmd(args: _Namespace) -> int:
if args.update:
merge_strat = MergeStrategy.UPDATE

log_package()

return (
0
if ARBITER.encode(
Expand Down
9 changes: 8 additions & 1 deletion yambs/commands/native.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,21 @@
from vcorelib.args import CommandFunction as _CommandFunction

# internal
from yambs.commands.common import add_common_args, handle_build, run_watch
from yambs.commands.common import (
add_common_args,
handle_build,
log_package,
run_watch,
)
from yambs.config.native import load_native
from yambs.environment.native import NativeBuildEnvironment


def native_cmd(args: _Namespace) -> int:
"""Execute the native command."""

log_package()

config = load_native(path=args.config, root=args.dir)

NativeBuildEnvironment(config).generate(sources_only=args.sources)
Expand Down

0 comments on commit 5ad4b10

Please sign in to comment.