scargo.commands package

Submodules

scargo.commands.build module

Build project bin/lib exec file

scargo.commands.build.scargo_build(profile: str, target: Optional[ScargoTarget], all_targets: bool = False) None[source]

Build project exec file.

Parameters
  • profile (str) – Profile

  • target – Target to build

  • all_targets (bool) – Build all targets

Returns

None

scargo.commands.check module

Check written code with formatters

class scargo.commands.check.CheckResult(problems_found, fix)[source]

Bases: tuple

fix: bool

Alias for field number 1

problems_found: int

Alias for field number 0

class scargo.commands.check.CheckerFixer(config: Config, fix_errors: bool = False, verbose: bool = False)[source]

Bases: ABC

can_fix = False
check() int[source]
abstract check_file(file_path: Path) CheckResult[source]
check_files() int[source]
check_name: str
fix_file(file_path: Path) None[source]
static format_problem_count(count: int) str[source]
get_check_config() CheckConfig[source]
get_exclude_patterns() List[str][source]
headers_only = False
report(count: int) None[source]
class scargo.commands.check.ClangFormatChecker(config: Config, fix_errors: bool = False, verbose: bool = False)[source]

Bases: CheckerFixer

can_fix = True
check_file(file_path: Path) CheckResult[source]
check_name: str = 'clang-format'
fix_file(file_path: Path) None[source]
class scargo.commands.check.ClangTidyChecker(config: Config, fix_errors: bool = False, verbose: bool = False)[source]

Bases: CheckerFixer

build_path: Optional[Path] = None
check_file(file_path: Path) CheckResult[source]
check_name: str = 'clang-tidy'
class scargo.commands.check.CopyrightChecker(config: Config, fix_errors: bool = False, verbose: bool = False)[source]

Bases: CheckerFixer

can_fix = True
check() int[source]
check_file(file_path: Path) CheckResult[source]
check_name: str = 'copyright'
fix_file(file_path: Path) None[source]
class scargo.commands.check.CppcheckChecker(config: Config, fix_errors: bool = False, verbose: bool = False)[source]

Bases: CheckerFixer

check_file(file_path: Path) CheckResult[source]
check_files() int[source]

Run cppcheck with the configured suppressions and directories and collect all issues.

check_name: str = 'cppcheck'
get_directories_to_check() List[str][source]

Retrieve the directories to check from the config.

get_suppression_rules() List[str][source]

Retrieve the suppression rules from the config.

report(count: int) None[source]

Report the check status, providing a summary of all issues found.

class scargo.commands.check.CyclomaticChecker(config: Config, fix_errors: bool = False, verbose: bool = False)[source]

Bases: CheckerFixer

check_file(file_path: Path) CheckResult[source]
check_files() int[source]

Run lizard with the configured parameters and collect all cyclomatic complexity issues.

check_name: str = 'cyclomatic'
report(count: int) None[source]
class scargo.commands.check.PragmaChecker(config: Config, fix_errors: bool = False, verbose: bool = False)[source]

Bases: CheckerFixer

can_fix = True
check_file(file_path: Path) CheckResult[source]
check_name: str = 'pragma'
fix_file(file_path: Path) None[source]
headers_only = True
class scargo.commands.check.TodoChecker(config: Config, fix_errors: bool = False, verbose: bool = False)[source]

Bases: CheckerFixer

check_file(file_path: Path) CheckResult[source]
check_name: str = 'todo'
static format_problem_count(count: int) str[source]
get_check_config() TodoCheckConfig[source]
scargo.commands.check.find_files(dir_path: Path, glob_patterns: Sequence[str], exclude_patterns: Sequence[str]) Iterable[Path][source]
scargo.commands.check.scargo_check(clang_format: bool, clang_tidy: bool, copy_right: bool, cppcheck: bool, cyclomatic: bool, pragma: bool, todo: bool, verbose: bool) None[source]

Check written code using different formatters

Parameters
  • clang_format (bool) – check clang_format

  • clang_tidy (bool) – check clang_tidy

  • copy_right (bool) – check copyrights

  • cppcheck (bool) – check cpp format

  • cyclomatic (bool) – check cyclomatic

  • pragma (bool) – check pragma

  • todo (bool) – check todo left in code

  • verbose (bool) – set verbose

Returns

None

scargo.commands.clean module

Clean project from unnecessary files

scargo.commands.clean.handle_item_deletion(item: Path) None[source]

Handle the deletion of a file or directory.

scargo.commands.clean.process_directory(directory: Path) None[source]

Process each item in the given directory.

scargo.commands.clean.scargo_clean() None[source]

Clean project dir from unnecessary files

scargo.commands.debug module

scargo.commands.debug.scargo_debug(bin_path: Optional[Path], target: Optional[ScargoTarget]) None[source]

scargo.commands.doc module

Create project documentation

scargo.commands.doc.scargo_doc(open_doc: bool) None[source]

Create documentation for project

Parameters

open_doc (bool) – if true open documentation instead creating it

Returns

None

scargo.commands.docker module

Handle docker for project

scargo.commands.docker.get_docker_compose_command() List[str][source]

Get docker command

Returns

_description_

Return type

List[str]

scargo.commands.docker.scargo_docker_build(docker_opts: Sequence[str], project_root: Optional[Path] = None) None[source]

Build docker

Parameters
  • docker_opts – additional docker options

  • project_root – scargo project root path

Raises

CalledProcessError – if docker build fail

scargo.commands.docker.scargo_docker_exec(docker_opts: List[str]) None[source]

Exec docker

Parameters

docker_opts – additional docker options

Raises

CalledProcessError – if docker did not start

scargo.commands.docker.scargo_docker_run(docker_opts: Sequence[str], command: Optional[str] = None) None[source]

Run docker

Parameters
  • docker_opts – additional docker options

  • command – command to run in the container

Raises

CalledProcessError – if docker did not start

scargo.commands.fix module

Format project code using formatter

scargo.commands.fix.scargo_fix(pragma: bool, copy_right: bool, clang_format: bool) None[source]

Fix format

Parameters
  • pragma (bool) – fix pragma format

  • copy_right (bool) – fix copyrights

  • clang_format (bool) – fix clang format

Returns

None

scargo.commands.flash module

scargo.commands.flash.scargo_flash(flash_profile: str, port: Optional[str], target: Optional[ScargoTarget], app: bool, file_system: bool, erase_memory: bool, bank: Optional[int] = None) None[source]

scargo.commands.gen module

scargo.commands.gen.gen_single_binary(build_profile: str, config: Config) None[source]
scargo.commands.gen.generate_certs(device_name: str, mode_for_certs: Optional[str], certs_intermediate_dir: Optional[Path], certs_passwd: Optional[str], project_path: Path) None[source]
scargo.commands.gen.generate_fs(config: Config) None[source]
scargo.commands.gen.scargo_gen(profile: str, gen_ut: Optional[Path], gen_mock: Optional[Path], certs: Optional[str], certs_mode: Optional[str], certs_input: Optional[Path], certs_passwd: Optional[str], fs: bool, single_bin: bool) None[source]

scargo.commands.monitor module

class scargo.commands.monitor.CmdLoop(ser: Serial)[source]

Bases: object

parse_cmd(cmd: str) bool[source]

Parse command to the device

Parameters

cmd (str) – command

Returns

send successfully to the device

Return type

bool

run() None[source]

Infinit keyboard input loop

stop() None[source]

Stop the infinit loop

class scargo.commands.monitor.SerialReadThread(ser: Serial, read_block_size: int = 1000)[source]

Bases: Thread

TOO_MANY_ERROR_MESSAGE = 'Too many consecutive errors, stopping monitor.'
read_serial() None[source]

Read data from the serial interface

run() None[source]

Infinite serial read/write loop

stop() None[source]

Stop the infinit loop

scargo.commands.monitor.scargo_monitor(port: Optional[str], baudrate: Optional[int]) None[source]

scargo.commands.new module

Create new project

scargo.commands.new.get_build_env(create_docker: bool) str[source]

Get build env :param bool create_docker: if create docker :return: build env

scargo.commands.new.get_chip_target(chip_label: str) Optional[str][source]
scargo.commands.new.process_chips(chips: List[str], targets: List[ScargoTarget]) Dict[str, str][source]
scargo.commands.new.scargo_new(name: str, bin_name: Optional[str], lib_name: Optional[str], targets: List[ScargoTarget], create_docker: bool, git: bool, chip: List[str]) None[source]

Create new project

Parameters
  • name (str) – name of project

  • bin_name (Optional[str]) – name of bin file

  • lib_name (Optional[str]) – name of lib file

  • targets (List[Target]) – target types for a project

  • create_docker (bool) – initialize docker environment

  • git (bool) – initialize git repository

  • chip (List[str]) – list of chips for targets

Returns

None

Raises

FileExistsError – if project with provided name exist

scargo.commands.publish module

Publish conan package into repository

scargo.commands.publish.scargo_publish(repo: str, profile: str = 'Release') None[source]

Publish conan package

Parameters

repo (str) – repository name

Returns

None

scargo.commands.run module

Run feature depending on provided args

scargo.commands.run.scargo_run(bin_path: Optional[Path], profile: str, params: List[str], skip_build: bool) None[source]

Run command from CLI

Parameters
  • bin_path (str) – path to bin file

  • profile (Path) – build profile name

  • params (str) – params for bin file

  • skip_build (bool) – skip build step

Returns

None

scargo.commands.test module

Run test from project

scargo.commands.test.run_it(config: Config, verbose: bool) None[source]
scargo.commands.test.run_ut(config: Config, verbose: bool, cwd: Path, detailed_coverage: bool) None[source]
scargo.commands.test.scargo_test(verbose: bool, profile: str = 'Debug', detailed_coverage: bool = False) None[source]

Run test :param bool verbose: if verbose :param str profile: CMake profile to use :param bool detailed_coverage: Generate detailed coverage HTML files

scargo.commands.update module

Update project

scargo.commands.update.copy_file_if_not_exists(project_path: Path) None[source]

Copy file from scargo pkg

Returns

None

scargo.commands.update.pull_docker_image(docker_path: Path) bool[source]
scargo.commands.update.scargo_update(config_file_path: Path) None[source]

Update project

Parameters

config_file_path – path to .toml configuration file (e.g. scargo.toml)

Returns

None

scargo.commands.version module

feature function for scargo

scargo.commands.version.scargo_version() None[source]

Module contents