[Info] Added environment vars, KiBot paths and KiAuto info.
This commit is contained in:
parent
835920810e
commit
f156a23f3f
|
|
@ -126,6 +126,7 @@ Notes:
|
|||
- Mandatory for: `gencad`, `netlist`, `pdf_pcb_print`, `pdf_sch_print`, `render_3d`, `run_drc`, `run_erc`, `step`, `svg_pcb_print`, `svg_sch_print`, `update_xml`
|
||||
- Optional to:
|
||||
- Compare schematics for `diff` (v2.0.0)
|
||||
- Show KiAuto installation information for `info` (v2.0.0)
|
||||
- Print the page frame in GUI mode for `pcb_print` (v1.6.7)
|
||||
|
||||
[**KiCost**](https://github.com/hildogjr/KiCost) v1.1.8 [](https://github.com/hildogjr/KiCost) 
|
||||
|
|
@ -1940,8 +1941,7 @@ Notes:
|
|||
* Description: Records information about the current run.
|
||||
It can be used to know more about the environment used to generate the files.
|
||||
Please don't rely on the way things are reported, its content could change,
|
||||
adding or removing information.
|
||||
It current shows the `kibot-check` output
|
||||
adding or removing information
|
||||
* Valid keys:
|
||||
- **`comment`**: [string=''] A comment for documentation purposes.
|
||||
- **`dir`**: [string='./'] Output directory for the generated files.
|
||||
|
|
@ -1950,6 +1950,8 @@ Notes:
|
|||
- **`options`**: [dict] Options for the `info` output.
|
||||
* Valid keys:
|
||||
- **`output`**: [string='%f-%i%I%v.%x'] Filename for the output (%i=info, %x=txt). Affected by global options.
|
||||
- `environment`: [string='names'] [names,none,full] List environment variables.
|
||||
IMPORTANT: Don't use `full` unless you know you are not leaking sensitive information.
|
||||
- `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used.
|
||||
Categories looks like file system paths, i.e. PCB/fabrication/gerber.
|
||||
- `disable_run_by_default`: [string|boolean] Use it to disable the `run_by_default` status of other output.
|
||||
|
|
|
|||
|
|
@ -852,13 +852,15 @@ outputs:
|
|||
# Info:
|
||||
# It can be used to know more about the environment used to generate the files.
|
||||
# Please don't rely on the way things are reported, its content could change,
|
||||
# adding or removing information.
|
||||
# It current shows the `kibot-check` output
|
||||
# adding or removing information
|
||||
- name: 'info_example'
|
||||
comment: 'Records information about the current run.'
|
||||
type: 'info'
|
||||
dir: 'Example/info_dir'
|
||||
options:
|
||||
# [string='names'] [names,none,full] List environment variables.
|
||||
# IMPORTANT: Don't use `full` unless you know you are not leaking sensitive information
|
||||
environment: 'names'
|
||||
# [string='%f-%i%I%v.%x'] Filename for the output (%i=info, %x=txt). Affected by global options
|
||||
output: '%f-%i%I%v.%x'
|
||||
# KiBoM (KiCad Bill of Materials):
|
||||
|
|
|
|||
|
|
@ -3,6 +3,12 @@
|
|||
# Copyright (c) 2022 Instituto Nacional de Tecnología Industrial
|
||||
# License: GPL-3.0
|
||||
# Project: KiBot (formerly KiPlot)
|
||||
"""
|
||||
Dependencies:
|
||||
- from: KiAuto
|
||||
role: Show KiAuto installation information
|
||||
version: 2.0.0
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
from .gs import GS
|
||||
|
|
@ -19,6 +25,9 @@ class InfoOptions(BaseOptions):
|
|||
with document:
|
||||
self.output = GS.def_global_output
|
||||
""" *Filename for the output (%i=info, %x=txt) """
|
||||
self.environment = 'names'
|
||||
""" [names,none,full] List environment variables.
|
||||
IMPORTANT: Don't use `full` unless you know you are not leaking sensitive information """
|
||||
super().__init__()
|
||||
self._expand_id = 'info'
|
||||
self._expand_ext = 'txt'
|
||||
|
|
@ -29,9 +38,23 @@ class InfoOptions(BaseOptions):
|
|||
|
||||
def run(self, name):
|
||||
dir = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||
ret = run_command([os.path.join(dir, 'kibot-check')])
|
||||
ret = run_command([os.path.join(dir, 'kibot-check'), '-p'])
|
||||
with open(name, 'wt') as f:
|
||||
f.write(ret+'\n')
|
||||
# Environment
|
||||
if self.environment == 'names':
|
||||
f.write('\nEnvironment:\n')
|
||||
for n in sorted(os.environ.keys()):
|
||||
f.write(n+'\n')
|
||||
elif self.environment == 'full':
|
||||
f.write('\nEnvironment:\n')
|
||||
for n in sorted(os.environ.keys()):
|
||||
f.write(n+'='+os.environ[n]+'\n')
|
||||
# KiAuto
|
||||
command = self.check_tool('KiAuto')
|
||||
if command:
|
||||
ret = run_command([command, '--info'])
|
||||
f.write('\nKiAuto:\n'+ret+'\n')
|
||||
|
||||
|
||||
@output_class
|
||||
|
|
@ -40,8 +63,7 @@ class Info(BaseOutput): # noqa: F821
|
|||
Records information about the current run.
|
||||
It can be used to know more about the environment used to generate the files.
|
||||
Please don't rely on the way things are reported, its content could change,
|
||||
adding or removing information.
|
||||
It current shows the `kibot-check` output """
|
||||
adding or removing information """
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self._category = ['PCB/docs', 'Schematic/docs']
|
||||
|
|
|
|||
|
|
@ -6,3 +6,5 @@ outputs:
|
|||
- name: 'do_info'
|
||||
comment: "Information about the run"
|
||||
type: info
|
||||
options:
|
||||
environment: full
|
||||
|
|
|
|||
Loading…
Reference in New Issue