Added numbers to all the warnings
This commit is contained in:
parent
8605ccdea4
commit
c8e81a4668
|
|
@ -72,7 +72,7 @@ from .kiplot import (generate_outputs, load_actions, config_output)
|
|||
from .pre_base import (BasePreFlight)
|
||||
from .config_reader import (CfgYamlReader, print_outputs_help, print_output_help, print_preflights_help, create_example,
|
||||
print_filters_help)
|
||||
from .misc import (NO_PCB_FILE, NO_SCH_FILE, EXIT_BAD_ARGS)
|
||||
from .misc import (NO_PCB_FILE, NO_SCH_FILE, EXIT_BAD_ARGS, W_VARSCH, W_VARCFG, W_VARPCB, W_PYCACHE)
|
||||
from .docopt import docopt
|
||||
|
||||
logger = None
|
||||
|
|
@ -148,7 +148,7 @@ def solve_schematic(a_schematic, a_board_file):
|
|||
break
|
||||
if schematic is None:
|
||||
schematic = schematics[0]
|
||||
logger.warning('More than one SCH file found in current directory.\n'
|
||||
logger.warning(W_VARSCH + 'More than one SCH file found in current directory.\n'
|
||||
' Using '+schematic+' if you want to use another use -e option.')
|
||||
if schematic and not os.path.isfile(schematic):
|
||||
logger.error("Schematic file not found: "+schematic)
|
||||
|
|
@ -170,7 +170,7 @@ def solve_config(a_plot_config):
|
|||
logger.info('Using config file: '+plot_config)
|
||||
elif len(plot_configs) > 1:
|
||||
plot_config = plot_configs[0]
|
||||
logger.warning('More than one config file found in current directory.\n'
|
||||
logger.warning(W_VARCFG + 'More than one config file found in current directory.\n'
|
||||
' Using '+plot_config+' if you want to use another use -c option.')
|
||||
else:
|
||||
logger.error('No config file found (*.kibot.yaml), use -c to specify one.')
|
||||
|
|
@ -201,7 +201,7 @@ def solve_board_file(schematic, a_board_file):
|
|||
logger.info('Using PCB file: '+board_file)
|
||||
elif len(board_files) > 1:
|
||||
board_file = board_files[0]
|
||||
logger.warning('More than one PCB file found in current directory.\n'
|
||||
logger.warning(W_VARPCB + 'More than one PCB file found in current directory.\n'
|
||||
' Using '+board_file+' if you want to use another use -b option.')
|
||||
check_board_file(board_file)
|
||||
if board_file:
|
||||
|
|
@ -245,7 +245,7 @@ def clean_cache():
|
|||
else:
|
||||
raise PermissionError()
|
||||
except PermissionError:
|
||||
logger.warning('Wrong installation, avoid creating Python cache files\n'
|
||||
logger.warning(W_PYCACHE + 'Wrong installation, avoid creating Python cache files\n'
|
||||
'If you are using `pip` to install use the `--no-compile` option:\n'
|
||||
'$ pip install --no-compile kibot\n')
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ from copy import deepcopy
|
|||
from .units import compare_values, comp_match
|
||||
from .bom_writer import write_bom
|
||||
from .columnlist import ColumnList
|
||||
from ..misc import DNF
|
||||
from ..misc import DNF, W_FIELDCONF
|
||||
from .. import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
|
@ -215,7 +215,7 @@ class ComponentGroup(object):
|
|||
# Config contains variant information, which is different for each component
|
||||
# Part can be one of the defined aliases
|
||||
if field != self.cfg.fit_field and field != 'part':
|
||||
logger.warning("Field conflict: ({refs}) [{name}] : '{flds}' <- '{fld}' (in {ref})".format(
|
||||
logger.warning(W_FIELDCONF + "Field conflict: ({refs}) [{name}] : '{flds}' <- '{fld}' (in {ref})".format(
|
||||
refs=self.get_refs(),
|
||||
name=field,
|
||||
flds=self.fields[field],
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ Oriented to normalize and sort R, L and C values.
|
|||
import re
|
||||
import locale
|
||||
from .. import log
|
||||
from ..misc import W_BADVAL1, W_BADVAL2, W_BADVAL3
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
|
@ -131,12 +132,12 @@ def comp_match(component, ref_prefix):
|
|||
|
||||
result = match.match(component)
|
||||
if not result:
|
||||
logger.warning("Malformed value: `{}` (no match)".format(original))
|
||||
logger.warning(W_BADVAL1 + "Malformed value: `{}` (no match)".format(original))
|
||||
return None
|
||||
|
||||
value, prefix, units, post = result.groups()
|
||||
if value == '.':
|
||||
logger.warning("Malformed value: `{}` (reduced to decimal point)".format(original))
|
||||
logger.warning(W_BADVAL2 + "Malformed value: `{}` (reduced to decimal point)".format(original))
|
||||
return None
|
||||
if value == '':
|
||||
value = '0'
|
||||
|
|
@ -147,7 +148,7 @@ def comp_match(component, ref_prefix):
|
|||
# We will also have a trailing number
|
||||
if post:
|
||||
if "." in value:
|
||||
logger.warning("Malformed value: `{}` (unit split, but contains decimal point)".format(original))
|
||||
logger.warning(W_BADVAL3 + "Malformed value: `{}` (unit split, but contains decimal point)".format(original))
|
||||
return None
|
||||
value = float(value)
|
||||
postValue = float(post) / (10 ** len(post))
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ from collections import OrderedDict
|
|||
|
||||
from .error import (KiPlotConfigurationError, config_error)
|
||||
from .kiplot import (load_board)
|
||||
from .misc import (NO_YAML_MODULE, EXIT_BAD_ARGS, EXAMPLE_CFG, WONT_OVERWRITE)
|
||||
from .misc import (NO_YAML_MODULE, EXIT_BAD_ARGS, EXAMPLE_CFG, WONT_OVERWRITE, W_UNKGLOBAL)
|
||||
from .gs import GS
|
||||
from .registrable import RegOutput, RegVariant, RegFilter
|
||||
from .pre_base import BasePreFlight
|
||||
|
|
@ -171,7 +171,7 @@ class CfgYamlReader(object):
|
|||
elif k == 'variant':
|
||||
GS.global_variant = self._parse_global_str(k, v, GS.global_variant)
|
||||
else:
|
||||
logger.warning("Unknown global option `{}`".format(k))
|
||||
logger.warning(W_UNKGLOBAL + "Unknown global option `{}`".format(k))
|
||||
|
||||
def read(self, fstream):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import platform
|
|||
import sysconfig
|
||||
from ..gs import GS
|
||||
from .. import log
|
||||
from ..misc import W_NOHOME, W_NOUSER, W_BADSYS, W_NOCONFIG, W_NOKIENV, W_NOLIBS, W_NODEFSYMLIB
|
||||
|
||||
# Check python version to determine which version of ConfirParser to import
|
||||
if sys.version_info.major >= 3:
|
||||
|
|
@ -140,7 +141,7 @@ class KiConf(object):
|
|||
# Linux: ~/.config/kicad/
|
||||
home = os.environ.get('HOME')
|
||||
if not home:
|
||||
logger.warning('Environment variable `HOME` not defined, using `/`')
|
||||
logger.warning(W_NOHOME + 'Environment variable `HOME` not defined, using `/`')
|
||||
home = '/'
|
||||
cfg = os.path.join(home, '.config', 'kicad', KICAD_COMMON)
|
||||
if os.path.isfile(cfg):
|
||||
|
|
@ -149,7 +150,7 @@ class KiConf(object):
|
|||
# MacOSX: ~/Library/Preferences/kicad/
|
||||
home = os.environ.get('HOME')
|
||||
if not home:
|
||||
logger.warning('Environment variable `HOME` not defined, using `/`')
|
||||
logger.warning(W_NOHOME + 'Environment variable `HOME` not defined, using `/`')
|
||||
home = '/'
|
||||
cfg = os.path.join(home, 'Library', 'Preferences', 'kicad', KICAD_COMMON)
|
||||
if os.path.isfile(cfg):
|
||||
|
|
@ -159,7 +160,7 @@ class KiConf(object):
|
|||
# or C:\Documents and Settings\username\Application Data\kicad
|
||||
username = os.environ.get('username')
|
||||
if not username:
|
||||
logger.warning('Unable to determine current user')
|
||||
logger.warning(W_NOUSER + 'Unable to determine current user')
|
||||
return None
|
||||
cfg = os.path.join('C:', 'Users', username, 'AppData', 'Roaming', 'kicad', KICAD_COMMON)
|
||||
if os.path.isfile(cfg):
|
||||
|
|
@ -168,9 +169,9 @@ class KiConf(object):
|
|||
if os.path.isfile(cfg):
|
||||
return cfg
|
||||
else: # pragma: no cover
|
||||
logger.warning('Unsupported system `{}`'.format(system))
|
||||
logger.warning(W_BADSYS + 'Unsupported system `{}`'.format(system))
|
||||
return None
|
||||
logger.warning('Unable to find KiCad configuration file ({})'.format(cfg))
|
||||
logger.warning(W_NOCONFIG + 'Unable to find KiCad configuration file ({})'.format(cfg))
|
||||
return None
|
||||
|
||||
def guess_symbol_dir():
|
||||
|
|
@ -230,7 +231,7 @@ class KiConf(object):
|
|||
cf.optionxform = str
|
||||
cf.readfp(io_buf, cfg)
|
||||
if 'EnvironmentVariables' not in cf.sections():
|
||||
logger.warning('KiCad config without EnvironmentVariables section')
|
||||
logger.warning(W_NOKIENV + 'KiCad config without EnvironmentVariables section')
|
||||
else:
|
||||
for k, v in cf.items('EnvironmentVariables'):
|
||||
if GS.debug_level > 1:
|
||||
|
|
@ -245,7 +246,7 @@ class KiConf(object):
|
|||
KiConf.sym_lib_dir = sym_dir
|
||||
logger.debug('Detected KICAD_SYMBOL_DIR="{}"'.format(sym_dir))
|
||||
else:
|
||||
logger.warning('Unable to find KiCad libraries')
|
||||
logger.warning(W_NOLIBS + 'Unable to find KiCad libraries')
|
||||
|
||||
def load_lib_aliases(fname):
|
||||
if not os.path.isfile(fname):
|
||||
|
|
@ -275,7 +276,7 @@ class KiConf(object):
|
|||
if KiConf.config_dir:
|
||||
KiConf.load_lib_aliases(os.path.join(KiConf.config_dir, SYM_LIB_TABLE))
|
||||
else:
|
||||
logger.warning('Missing default symbol library table')
|
||||
logger.warning(W_NODEFSYMLIB + 'Missing default symbol library table')
|
||||
# No default symbol libs table, try to create one
|
||||
if KiConf.sym_lib_dir:
|
||||
for f in glob(os.path.join(KiConf.sym_lib_dir, '*.lib')):
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ import os
|
|||
from collections import OrderedDict
|
||||
from .config import KiConf, un_quote
|
||||
from ..gs import GS
|
||||
from ..misc import (W_BADPOLI, W_POLICOORDS, W_BADSQUARE, W_BADCIRCLE, W_BADARC, W_BADTEXT, W_BADPIN, W_BADCOMP, W_BADDRAW,
|
||||
W_UNKDCM, W_UNKAR, W_ARNOPATH, W_ARNOREF, W_MISCFLD, W_EXTRASPC, W_NOLIB, W_INCPOS, W_NOANNO, W_MISSLIB,
|
||||
W_MISSDCM, W_MISSCMP)
|
||||
from .. import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
|
@ -169,7 +172,7 @@ class DrawPoligon(object):
|
|||
def parse(line):
|
||||
m = DrawPoligon.pol_re.match(line)
|
||||
if not m:
|
||||
logger.warning('Unknown poligon definition `{}`'.format(line))
|
||||
logger.warning(W_BADPOLI + 'Unknown poligon definition `{}`'.format(line))
|
||||
return None
|
||||
pol = DrawPoligon()
|
||||
g = m.groups()
|
||||
|
|
@ -180,7 +183,7 @@ class DrawPoligon(object):
|
|||
pol.fill = g[5]
|
||||
coords = _split_space(g[4])
|
||||
if len(coords) != 2*pol.points:
|
||||
logger.warning('Expected {} coordinates and got {} in poligon'.format(2*pol.points, len(coords)))
|
||||
logger.warning(W_POLICOORDS + 'Expected {} coordinates and got {} in poligon'.format(2*pol.points, len(coords)))
|
||||
pol.points = int(len(coords)/2)
|
||||
pol.coords = [int(c) for c in coords]
|
||||
return pol
|
||||
|
|
@ -224,7 +227,7 @@ class DrawRectangle(object):
|
|||
def parse(line):
|
||||
m = DrawRectangle.rec_re.match(line)
|
||||
if not m:
|
||||
logger.warning('Unknown square definition `{}`'.format(line))
|
||||
logger.warning(W_BADSQUARE + 'Unknown square definition `{}`'.format(line))
|
||||
return None
|
||||
rec = DrawRectangle()
|
||||
g = m.groups()
|
||||
|
|
@ -267,7 +270,7 @@ class DrawCircle(object):
|
|||
def parse(line):
|
||||
m = DrawCircle.cir_re.match(line)
|
||||
if not m:
|
||||
logger.warning('Unknown circle definition `{}`'.format(line))
|
||||
logger.warning(W_BADCIRCLE + 'Unknown circle definition `{}`'.format(line))
|
||||
return None
|
||||
cir = DrawCircle()
|
||||
g = m.groups()
|
||||
|
|
@ -315,7 +318,7 @@ class DrawArc(object):
|
|||
def parse(line):
|
||||
m = DrawArc.arc_re.match(line)
|
||||
if not m:
|
||||
logger.warning('Unknown arc definition `{}`'.format(line))
|
||||
logger.warning(W_BADARC + 'Unknown arc definition `{}`'.format(line))
|
||||
return None
|
||||
arc = DrawArc()
|
||||
g = m.groups()
|
||||
|
|
@ -370,7 +373,7 @@ class DrawText(object):
|
|||
def parse(line):
|
||||
m = DrawText.txt_re.match(line)
|
||||
if not m:
|
||||
logger.warning('Unknown text definition `{}`'.format(line))
|
||||
logger.warning(W_BADTEXT + 'Unknown text definition `{}`'.format(line))
|
||||
return None
|
||||
txt = DrawText()
|
||||
g = m.groups()
|
||||
|
|
@ -419,7 +422,7 @@ class Pin(object):
|
|||
def parse(line):
|
||||
m = Pin.pin_re.match(line)
|
||||
if not m:
|
||||
logger.warning('Unknown pin definition `{}`'.format(line))
|
||||
logger.warning(W_BADPIN + 'Unknown pin definition `{}`'.format(line))
|
||||
return None
|
||||
pin = Pin()
|
||||
g = m.groups()
|
||||
|
|
@ -492,7 +495,7 @@ class LibComponent(object):
|
|||
if GS.debug_level > 2:
|
||||
logger.debug('- Loading component {} from {}'.format(self.name, lib_name))
|
||||
else:
|
||||
logger.warning('Failed to load component definition: `{}`'.format(line))
|
||||
logger.warning(W_BADCOMP + 'Failed to load component definition: `{}`'.format(line))
|
||||
# Mark it as broken
|
||||
self.name = None
|
||||
self.fields = []
|
||||
|
|
@ -530,7 +533,7 @@ class LibComponent(object):
|
|||
elif line[0] == 'X':
|
||||
self.draw.append(Pin.parse(line))
|
||||
else:
|
||||
logger.warning('Unknown draw element `{}`'.format(line))
|
||||
logger.warning(W_BADDRAW + 'Unknown draw element `{}`'.format(line))
|
||||
line = f.get_line()
|
||||
line = f.get_line()
|
||||
|
||||
|
|
@ -659,7 +662,7 @@ class DocLibEntry(object):
|
|||
elif line[0] == 'F':
|
||||
self.datasheet = line[2:].lstrip()
|
||||
else:
|
||||
logger.warning('Unknown DCM attribute `{}` on line {}'.format(line, f.line))
|
||||
logger.warning(W_UNKDCM + 'Unknown DCM attribute `{}` on line {}'.format(line, f.line))
|
||||
line = f.get_line()
|
||||
|
||||
def __repr__(self):
|
||||
|
|
@ -758,11 +761,11 @@ class SchematicAltRef():
|
|||
elif r.startswith('Part='):
|
||||
ar.part = r[6:-1]
|
||||
else:
|
||||
logger.warning('Unknown AR field `{}`'.format(r))
|
||||
logger.warning(W_UNKAR + 'Unknown AR field `{}`'.format(r))
|
||||
if not ar.path:
|
||||
logger.warning('Alternative Reference without path `{}`'.format(line))
|
||||
logger.warning(W_ARNOPATH + 'Alternative Reference without path `{}`'.format(line))
|
||||
if not ar.ref:
|
||||
logger.warning('Alternative Reference without reference `{}`'.format(line))
|
||||
logger.warning(W_ARNOREF + 'Alternative Reference without reference `{}`'.format(line))
|
||||
return ar
|
||||
|
||||
def write(self, f):
|
||||
|
|
@ -874,14 +877,14 @@ class SchematicComponent(object):
|
|||
self.datasheet = f.value
|
||||
basic += 1
|
||||
if basic < 4:
|
||||
logger.warning('Component `{}` without the basic fields'.format(self.f_ref))
|
||||
logger.warning(W_MISCFLD + 'Component `{}` without the basic fields'.format(self.f_ref))
|
||||
|
||||
def _validate(self):
|
||||
for field in self.fields:
|
||||
cur_val = field.value
|
||||
stripped_val = cur_val.strip()
|
||||
if len(cur_val) != len(stripped_val):
|
||||
logger.warning("Field {} of component {} contains extra spaces: `{}` removing them.".
|
||||
logger.warning(W_EXTRASPC + "Field {} of component {} contains extra spaces: `{}` removing them.".
|
||||
format(field.name, self, field.value))
|
||||
field.value = stripped_val
|
||||
|
||||
|
|
@ -908,7 +911,7 @@ class SchematicComponent(object):
|
|||
comp.lib = res[0]
|
||||
libs[comp.lib] = None
|
||||
else:
|
||||
logger.warning("Component `{}` doesn't specify its library".format(comp.name))
|
||||
logger.warning(W_NOLIB + "Component `{}` doesn't specify its library".format(comp.name))
|
||||
# U N mm time_stamp
|
||||
line = f.get_line()
|
||||
if line[0] != 'U':
|
||||
|
|
@ -962,7 +965,7 @@ class SchematicComponent(object):
|
|||
xr = int(res[0])
|
||||
yr = int(res[1])
|
||||
if comp.x != xr or comp.y != yr:
|
||||
logger.warning('Inconsistent position for component {} ({},{} vs {},{})'.
|
||||
logger.warning(W_INCPOS + 'Inconsistent position for component {} ({},{} vs {},{})'.
|
||||
format(comp.f_ref, comp.x, comp.y, xr, yr))
|
||||
# Orientation matrix
|
||||
line = f.get_line()
|
||||
|
|
@ -980,7 +983,7 @@ class SchematicComponent(object):
|
|||
# Power, ground or power flag
|
||||
comp.is_power = comp.ref.startswith('#PWR') or comp.ref.startswith('#FLG')
|
||||
if comp.ref[-1] == '?':
|
||||
logger.warning('Component {} is not annotated'.format(comp))
|
||||
logger.warning(W_NOANNO + 'Component {} is not annotated'.format(comp))
|
||||
# Separate the reference in its components
|
||||
m = SchematicComponent.ref_re.match(comp.ref)
|
||||
if not m:
|
||||
|
|
@ -1456,7 +1459,7 @@ class Schematic(object):
|
|||
if GS.debug_level > 1:
|
||||
logger.debug('Using `{}` for library alias `{}`'.format(alias.uri, k))
|
||||
else:
|
||||
logger.warning('Missing library `{}`'.format(k))
|
||||
logger.warning(W_MISSLIB + 'Missing library `{}`'.format(k))
|
||||
# Create a hash with all the used components
|
||||
self.comps_data = {'{}:{}'.format(c.lib, c.name): None for c in self.get_components(exclude_power=False)}
|
||||
if GS.debug_level > 1:
|
||||
|
|
@ -1469,7 +1472,7 @@ class Schematic(object):
|
|||
o = SymLib()
|
||||
o.load(v, k, self.comps_data)
|
||||
else:
|
||||
logger.warning('Missing library `{}` ({})'.format(v, k))
|
||||
logger.warning(W_MISSLIB + 'Missing library `{}` ({})'.format(v, k))
|
||||
o = None
|
||||
self.lib_comps[k] = o
|
||||
# Load doc-lib
|
||||
|
|
@ -1494,7 +1497,7 @@ class Schematic(object):
|
|||
for name, comp in lib.comps.items():
|
||||
comp.dcm = dcm.comps.get(name)
|
||||
if not comp.dcm and k+':'+name in self.comps_data:
|
||||
logger.warning('Missing doc-lib entry for {}:{}'.format(k, name))
|
||||
logger.warning(W_MISSDCM + 'Missing doc-lib entry for {}:{}'.format(k, name))
|
||||
# Transfer the descriptions to the instances of the components
|
||||
self.walk_components(self.apply_dcm, self)
|
||||
|
||||
|
|
@ -1508,7 +1511,7 @@ class Schematic(object):
|
|||
if v:
|
||||
v.write(f, k, cross=cross)
|
||||
else:
|
||||
logger.warning('Missing component `{}`'.format(k))
|
||||
logger.warning(W_MISSCMP + 'Missing component `{}`'.format(k))
|
||||
f.write('#\n#End Library\n')
|
||||
|
||||
def save(self, fname, dest_dir):
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ from importlib.util import (spec_from_file_location, module_from_spec)
|
|||
from .gs import GS
|
||||
from .misc import (PLOT_ERROR, NO_PCBNEW_MODULE, MISSING_TOOL, CMD_EESCHEMA_DO, URL_EESCHEMA_DO, CORRUPTED_PCB,
|
||||
EXIT_BAD_ARGS, CORRUPTED_SCH, EXIT_BAD_CONFIG, WRONG_INSTALL, UI_SMD, UI_VIRTUAL, KICAD_VERSION_5_99,
|
||||
MOD_SMD, MOD_THROUGH_HOLE, MOD_VIRTUAL)
|
||||
MOD_SMD, MOD_THROUGH_HOLE, MOD_VIRTUAL, W_PCBNOSCH, W_NONEEDSKIP)
|
||||
from .error import PlotError, KiPlotConfigurationError, config_error, trace_dump
|
||||
from .pre_base import BasePreFlight
|
||||
from .kicad.v5_sch import Schematic, SchFileError
|
||||
|
|
@ -191,7 +191,7 @@ def get_board_comps_data(comps):
|
|||
for m in GS.board.GetModules():
|
||||
ref = m.GetReference()
|
||||
if ref not in comps_hash:
|
||||
logger.warning('`{}` component in board, but not in schematic'.format(ref))
|
||||
logger.warning(W_PCBNOSCH + '`{}` component in board, but not in schematic'.format(ref))
|
||||
continue
|
||||
c = comps_hash[ref]
|
||||
attrs = m.GetAttributes()
|
||||
|
|
@ -234,7 +234,7 @@ def preflight_checks(skip_pre):
|
|||
exit(EXIT_BAD_ARGS)
|
||||
o_pre = BasePreFlight.get_preflight(skip)
|
||||
if not o_pre:
|
||||
logger.warning('`{}` preflight is not in use, no need to skip'.format(skip))
|
||||
logger.warning(W_NONEEDSKIP + '`{}` preflight is not in use, no need to skip'.format(skip))
|
||||
else:
|
||||
logger.debug('Skipping `{}`'.format(skip))
|
||||
o_pre.disable()
|
||||
|
|
|
|||
|
|
@ -87,6 +87,51 @@ DNC = {
|
|||
"fixed",
|
||||
}
|
||||
|
||||
W_VARSCH = '(0) '
|
||||
W_VARCFG = '(1) '
|
||||
W_VARPCB = '(2) '
|
||||
W_PYCACHE = '(3) '
|
||||
W_FIELDCONF = '(4) '
|
||||
W_NOHOME = '(5) '
|
||||
W_NOUSER = '(6) '
|
||||
W_BADSYS = '(7) '
|
||||
W_NOCONFIG = '(8) '
|
||||
W_NOKIENV = '(9) '
|
||||
W_NOLIBS = '(10) '
|
||||
W_NODEFSYMLIB = '(11) '
|
||||
W_UNKGLOBAL = '(12) '
|
||||
W_PCBNOSCH = '(13) '
|
||||
W_NONEEDSKIP = '(14) '
|
||||
W_UNKOPS = '(15) '
|
||||
W_AMBLIST = '(16) '
|
||||
W_UNRETOOL = '(17) '
|
||||
W_USESVG2 = '(18) '
|
||||
W_USEIMAGICK = '(19) '
|
||||
W_BADVAL1 = '(20) '
|
||||
W_BADVAL2 = '(21) '
|
||||
W_BADVAL3 = '(22) '
|
||||
W_BADPOLI = '(23) '
|
||||
W_POLICOORDS = '(24) '
|
||||
W_BADSQUARE = '(25) '
|
||||
W_BADCIRCLE = '(26) '
|
||||
W_BADARC = '(27) '
|
||||
W_BADTEXT = '(28) '
|
||||
W_BADPIN = '(29) '
|
||||
W_BADCOMP = '(30) '
|
||||
W_BADDRAW = '(31) '
|
||||
W_UNKDCM = '(32) '
|
||||
W_UNKAR = '(33) '
|
||||
W_ARNOPATH = '(34) '
|
||||
W_ARNOREF = '(35) '
|
||||
W_MISCFLD = '(36) '
|
||||
W_EXTRASPC = '(37) '
|
||||
W_NOLIB = '(38) '
|
||||
W_INCPOS = '(39) '
|
||||
W_NOANNO = '(40) '
|
||||
W_MISSLIB = '(41) '
|
||||
W_MISSDCM = '(42) '
|
||||
W_MISSCMP = '(43) '
|
||||
|
||||
|
||||
class Rect(object):
|
||||
""" What KiCad returns isn't a real wxWidget's wxRect.
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import inspect
|
|||
from re import compile
|
||||
from .error import KiPlotConfigurationError
|
||||
from .gs import GS
|
||||
from .misc import W_UNKOPS
|
||||
from . import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
|
@ -97,7 +98,7 @@ class Optionable(object):
|
|||
if (k[0] == '_') or (k not in attrs):
|
||||
if self._unkown_is_error:
|
||||
raise KiPlotConfigurationError("Unknown option `{}`".format(k))
|
||||
logger.warning("Unknown option `{}`".format(k))
|
||||
logger.warning(W_UNKOPS + "Unknown option `{}`".format(k))
|
||||
continue
|
||||
# Check the data type
|
||||
cur_doc, alias, is_alias = self.get_doc(k)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from tempfile import (NamedTemporaryFile)
|
|||
# Here we import the whole module to make monkeypatch work
|
||||
import subprocess
|
||||
import shutil
|
||||
from .misc import PCBDRAW, PCBDRAW_ERR, URL_PCBDRAW
|
||||
from .misc import PCBDRAW, PCBDRAW_ERR, URL_PCBDRAW, W_AMBLIST, W_UNRETOOL, W_USESVG2, W_USEIMAGICK
|
||||
from .kiplot import check_script
|
||||
from .error import KiPlotConfigurationError
|
||||
from .gs import (GS)
|
||||
|
|
@ -156,7 +156,8 @@ class PcbDrawOptions(VariantOptions):
|
|||
self.show_components = ''
|
||||
elif isinstance(self.show_components, str):
|
||||
if self.variant or self.dnf_filter:
|
||||
logger.warning('Ambiguous list of components to show `{}` vs variant/filter'.format(self.show_components))
|
||||
logger.warning(W_AMBLIST + 'Ambiguous list of components to show `{}` vs variant/filter'.
|
||||
format(self.show_components))
|
||||
if self.show_components == 'none':
|
||||
self.show_components = ''
|
||||
else:
|
||||
|
|
@ -214,12 +215,12 @@ class PcbDrawOptions(VariantOptions):
|
|||
else:
|
||||
# PNG and JPG outputs are unreliable
|
||||
if shutil.which(SVG2PNG) is None:
|
||||
logger.warning('`{}` not installed, using unreliable PNG/JPG conversion'.format(SVG2PNG))
|
||||
logger.warning('If you experiment problems install `librsvg2-bin` or equivalent')
|
||||
logger.warning(W_UNRETOOL + '`{}` not installed, using unreliable PNG/JPG conversion'.format(SVG2PNG))
|
||||
logger.warning(W_USESVG2 + 'If you experiment problems install `librsvg2-bin` or equivalent')
|
||||
cmd.append(output)
|
||||
elif shutil.which(CONVERT) is None:
|
||||
logger.warning('`{}` not installed, using unreliable PNG/JPG conversion'.format(CONVERT))
|
||||
logger.warning('If you experiment problems install `imagemagick` or equivalent')
|
||||
logger.warning(W_UNRETOOL + '`{}` not installed, using unreliable PNG/JPG conversion'.format(CONVERT))
|
||||
logger.warning(W_USEIMAGICK + 'If you experiment problems install `imagemagick` or equivalent')
|
||||
cmd.append(output)
|
||||
else:
|
||||
svg = _get_tmp_name('.svg')
|
||||
|
|
|
|||
|
|
@ -227,8 +227,8 @@ def test_auto_pcb_and_cfg_2():
|
|||
|
||||
ctx.run(extra=['-s', 'all', '-i', 'pos_ascii'], no_out_dir=True, no_board_file=True, no_yaml_file=True, chdir_out=True)
|
||||
|
||||
assert ctx.search_err('WARNING:More than one PCB')
|
||||
assert ctx.search_err('WARNING:More than one config')
|
||||
assert ctx.search_err('More than one PCB')
|
||||
assert ctx.search_err('More than one config')
|
||||
m = ctx.search_err('Using (.*).kicad_pcb')
|
||||
assert m
|
||||
ctx.board_name = m.group(1)
|
||||
|
|
|
|||
|
|
@ -485,7 +485,6 @@ def test_unk_global():
|
|||
ctx = context.TestContext('UnkGlobal', 'bom', 'error_unk_global', '')
|
||||
ctx.run()
|
||||
assert ctx.search_err("Unknown global option")
|
||||
ctx.search_err("WARNING:Unknown global option")
|
||||
ctx.clean_up()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue