Added preflights help.

This commit is contained in:
Salvador E. Tropea 2020-06-25 10:31:23 -03:00
parent 523aaa2ace
commit 46a20404a4
10 changed files with 28 additions and 1 deletions

View File

@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Help for the supported outputs (--help-list-outputs, --help-outputs and
--help-output)
- Help for the supported preflights (--help-preflights)
- Better YAML validation.
### Fixed

View File

@ -18,7 +18,7 @@ from . import log
log.set_domain('kiplot')
from .kiplot import (GS, generate_outputs)
from .pre_base import (BasePreFlight)
from .config_reader import (CfgYamlReader, print_outputs_help, print_output_help)
from .config_reader import (CfgYamlReader, print_outputs_help, print_output_help, print_preflights_help)
from .misc import (NO_PCB_FILE, EXIT_BAD_ARGS)
from .__version__ import __version__
@ -33,6 +33,7 @@ def main():
parser.add_argument('--help-list-outputs', action='store_true', help='List supported outputs')
parser.add_argument('--help-output', help='Help for this particular output')
parser.add_argument('--help-outputs', action='store_true', help='List supported outputs and details')
parser.add_argument('--help-preflights', action='store_true', help='List supported preflights and details')
parser.add_argument('-i', '--invert-sel', action='store_true', help='Generate the outputs not listed as targets')
parser.add_argument('-l', '--list', action='store_true', help='List available outputs (in the config file)')
group.add_argument('-q', '--quiet', action='store_true', help='remove information logs')
@ -55,6 +56,9 @@ def main():
if args.help_output:
print_output_help(args.help_output)
sys.exit(0)
if args.help_preflights:
print_preflights_help()
sys.exit(0)
# Determine the PCB file
if args.board_file is None:

View File

@ -330,6 +330,7 @@ def print_one_out_help(details, n, o):
def print_outputs_help(details=False):
outs = BaseOutput.get_registered()
logger.debug('{} supported outputs'.format(len(outs)))
print('Supported outputs:')
for n, o in outs.items():
if details:
print()
@ -341,3 +342,14 @@ def print_output_help(name):
logger.error('Unknown output type `{}`, try --help-list-outputs'.format(name))
sys.exit(EXIT_BAD_ARGS)
print_one_out_help(True, name, BaseOutput.get_class_for(name))
def print_preflights_help():
pres = BasePreFlight.get_registered()
logger.debug('{} supported preflights'.format(len(pres)))
print('Supported preflight options:\n')
for n, o in pres.items():
help = o.__doc__
if help is None:
help = 'Undocumented'
print('- {}: {}.'.format(n, help.rstrip()))

View File

@ -23,6 +23,10 @@ class BasePreFlight(object):
def is_registered(name):
return name in BasePreFlight._registered
@staticmethod
def get_registered():
return BasePreFlight._registered
@staticmethod
def get_class_for(name):
return BasePreFlight._registered[name]

View File

@ -3,6 +3,7 @@ from .error import (KiPlotConfigurationError)
class CheckZoneFills(BasePreFlight):
""" [boolean=false] Zones are filled before doing any operation involving PCB layers """
def __init__(self, name, value):
super().__init__(name, value)
if not isinstance(value, bool):

View File

@ -10,6 +10,7 @@ logger = get_logger(__name__)
class DRC(BasePreFlight):
""" [boolean=false] Runs the DRC (Distance Rules Check). To ensure we have a valid PCB """
def __init__(self, name, value):
super().__init__(name, value)
if not isinstance(value, bool):

View File

@ -10,6 +10,7 @@ logger = get_logger(__name__)
class ERC(BasePreFlight):
""" [boolean=false] Runs the ERC (Electrical Rules Check). To ensure the schematic is electrically correct """
def __init__(self, name, value):
super().__init__(name, value)
if not isinstance(value, bool):

View File

@ -4,6 +4,7 @@ from .pre_base import (BasePreFlight)
class Filters(BasePreFlight):
""" A list of entries to filter out ERC/DRC messages. Keys: `filter`, `number` and `regex` """
def __init__(self, name, value):
super().__init__(name, value)

View File

@ -3,6 +3,7 @@ from .error import (KiPlotConfigurationError)
class IgnoreUnconnected(BasePreFlight):
""" [boolean=false] Option for `run_drc`. Ignores the unconnected nets. Useful if you didn't finish the routing """
def __init__(self, name, value):
super().__init__(name, value)
if not isinstance(value, bool):

View File

@ -10,6 +10,7 @@ logger = get_logger(__name__)
class UpdateXML(BasePreFlight):
""" [boolean=false] Update the XML version of the BoM (Bill of Materials). To ensure our generated BoM is up to date """
def __init__(self, name, value):
super().__init__(name, value)
if not isinstance(value, bool):