Give priority to submodule in out_kicost

This commit is contained in:
Salvador E. Tropea 2021-04-25 10:45:16 -03:00
parent 6f8a8fb2a0
commit 496de2712f
2 changed files with 8 additions and 4 deletions

View File

@ -71,6 +71,7 @@ CMD_IBOM = 'generate_interactive_bom.py'
URL_IBOM = 'https://github.com/INTI-CMNB/InteractiveHtmlBom' URL_IBOM = 'https://github.com/INTI-CMNB/InteractiveHtmlBom'
CMD_KICOST = 'kicost' CMD_KICOST = 'kicost'
URL_KICOST = 'https://github.com/INTI-CMNB/KiCost' URL_KICOST = 'https://github.com/INTI-CMNB/KiCost'
KICOST_SUBMODULE = '../submodules/KiCost/src/kicost'
KICAD2STEP = 'kicad2step' KICAD2STEP = 'kicad2step'
PCBDRAW = 'pcbdraw' PCBDRAW = 'pcbdraw'
URL_PCBDRAW = 'https://github.com/INTI-CMNB/pcbdraw' URL_PCBDRAW = 'https://github.com/INTI-CMNB/pcbdraw'

View File

@ -3,9 +3,9 @@
# Copyright (c) 2021 Instituto Nacional de Tecnología Industrial # Copyright (c) 2021 Instituto Nacional de Tecnología Industrial
# License: GPL-3.0 # License: GPL-3.0
# Project: KiBot (formerly KiPlot) # Project: KiBot (formerly KiPlot)
from os.path import isfile from os.path import isfile, abspath, join, dirname
from subprocess import check_output, STDOUT, CalledProcessError from subprocess import check_output, STDOUT, CalledProcessError
from .misc import CMD_KICOST, URL_KICOST, BOM_ERROR, DISTRIBUTORS, W_UNKDIST, ISO_CURRENCIES, W_UNKCUR from .misc import CMD_KICOST, URL_KICOST, BOM_ERROR, DISTRIBUTORS, W_UNKDIST, ISO_CURRENCIES, W_UNKCUR, KICOST_SUBMODULE
from .error import KiPlotConfigurationError from .error import KiPlotConfigurationError
from .optionable import Optionable from .optionable import Optionable
from .gs import GS from .gs import GS
@ -137,9 +137,12 @@ class KiCostOptions(VariantOptions):
logger.error('You can generate it using the `update_xml` pre-flight') logger.error('You can generate it using the `update_xml` pre-flight')
exit(BOM_ERROR) exit(BOM_ERROR)
# Check KiCost is available # Check KiCost is available
check_script(CMD_KICOST, URL_KICOST) cmd_kicost = abspath(join(dirname(__file__), KICOST_SUBMODULE))
if not isfile(cmd_kicost):
check_script(CMD_KICOST, URL_KICOST)
cmd_kicost = CMD_KICOST
# Construct the command # Construct the command
cmd = [CMD_KICOST, '-w', '-o', name, '-i', netlist] cmd = [cmd_kicost, '-w', '-o', name, '-i', netlist]
# Add the rest of input files and their variants # Add the rest of input files and their variants
if self.aggregate: if self.aggregate:
# More than one project # More than one project