[Dependencies] Added command line option to disable the downloads.

This commit is contained in:
Salvador E. Tropea 2022-07-01 13:30:51 -03:00
parent 9c6062e0c8
commit 664a13c548
4 changed files with 20 additions and 3 deletions

View File

@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- Try to download missing tools and Python modules.
The user also gets more information when something is missing.
It can be disabled from the command line.
## [1.2.0] - 2022-06-15
### Added

View File

@ -3252,7 +3252,7 @@ KiBot: KiCad automation tool for documents generation
Usage:
kibot [-b BOARD] [-e SCHEMA] [-c CONFIG] [-d OUT_DIR] [-s PRE]
[-q | -v...] [-C | -i | -n] [-m MKFILE] [-g DEF]... [TARGET...]
[-q | -v...] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ... [TARGET...]
kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] --list
kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] --example
kibot [-v...] [--start PATH] [-d OUT_DIR] [--dry] [-t, --type TYPE]...
@ -3271,6 +3271,7 @@ Arguments:
TARGET Outputs to generate, default is all
Options:
-A, --no-auto-download Disable dependencies auto-download
-b BOARD, --board-file BOARD The PCB .kicad-pcb board file
-c CONFIG, --plot-config CONFIG The plotting config file to use
-C, --cli-order Generate outputs using the indicated order

View File

@ -9,7 +9,7 @@
Usage:
kibot [-b BOARD] [-e SCHEMA] [-c CONFIG] [-d OUT_DIR] [-s PRE]
[-q | -v...] [-C | -i | -n] [-m MKFILE] [-g DEF]... [TARGET...]
[-q | -v...] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ... [TARGET...]
kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] --list
kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] --example
kibot [-v...] [--start PATH] [-d OUT_DIR] [--dry] [-t, --type TYPE]...
@ -28,6 +28,7 @@ Arguments:
TARGET Outputs to generate, default is all
Options:
-A, --no-auto-download Disable dependencies auto-download
-b BOARD, --board-file BOARD The PCB .kicad-pcb board file
-c CONFIG, --plot-config CONFIG The plotting config file to use
-C, --cli-order Generate outputs using the indicated order
@ -75,6 +76,7 @@ from . import __version__, __copyright__, __license__
from . import log
log.set_domain('kibot')
logger = log.init()
from . import dep_downloader
from .docopt import docopt
# GS will import pcbnew, so we must solve the nightly setup first
# Check if we have to run the nightly KiCad build
@ -255,6 +257,10 @@ def main():
var = redef.split('=')[0]
GS.cli_global_defs[var] = redef[len(var)+1:]
# Disable auto-download if needed
if args.no_auto_download:
dep_downloader.disable_auto_download = True
# Output dir: relative to CWD (absolute path overrides)
GS.out_dir = os.path.join(os.getcwd(), args.out_dir)

View File

@ -31,6 +31,7 @@ EXEC_PERM = stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_I
last_stderr = None
version_check_fail = False
binary_tools_cache = {}
disable_auto_download = False
def search_as_plugin(cmd, names):
@ -600,6 +601,9 @@ def check_tool_binary(dep):
cmd = check_tool_binary_local(dep)
if cmd is not None:
return cmd
global disable_auto_download
if disable_auto_download:
return None
return try_download_tool_binary(dep)
@ -635,7 +639,8 @@ def check_tool_python(dep, reload):
except ModuleNotFoundError:
pass
# Not installed, try to download it
if not python_downloader(dep):
global disable_auto_download
if disable_auto_download or not python_downloader(dep):
return None
# Check we can use it
try: