Replaced call to Optionable expand_filename_sch by self.expand_dirname

- In Pre ERC, DRC and update XML
This commit is contained in:
Diego Capusotto 2021-12-15 17:03:56 -03:00
parent 4f5b4c0619
commit 631cef7fd9
3 changed files with 8 additions and 9 deletions

View File

@ -34,7 +34,7 @@ class Run_DRC(BasePreFlight): # noqa: F821
load_board()
out_pattern = GS.global_output if GS.global_output is not None else GS.def_global_output
name = Optionable.expand_filename_pcb(self, out_pattern)
return [os.path.abspath(os.path.join(Optionable.expand_filename_pcb(self, GS.out_dir), name))]
return [os.path.abspath(os.path.join(self.expand_dirname(GS.out_dir), name))]
def run(self):
check_script(CMD_PCBNEW_RUN_DRC, URL_PCBNEW_RUN_DRC, '1.4.0')
@ -45,13 +45,13 @@ class Run_DRC(BasePreFlight): # noqa: F821
cmd.extend(['-f', GS.filter_file])
if BasePreFlight.get_option('ignore_unconnected'): # noqa: F821
cmd.append('-i')
cmd.extend([GS.pcb_file, Optionable.expand_filename_pcb(self, GS.out_dir)])
cmd.extend([GS.pcb_file, self.expand_dirname(GS.out_dir)])
# If we are in verbose mode enable debug in the child
cmd, video_remove = add_extra_options(cmd)
logger.info('- Running the DRC')
ret = exec_with_retry(cmd)
if video_remove:
video_name = os.path.join(Optionable.expand_filename_pcb(self, GS.out_dir), 'pcbnew_run_drc_screencast.ogv')
video_name = os.path.join(self.expand_dirname(GS.out_dir), 'pcbnew_run_drc_screencast.ogv')
if os.path.isfile(video_name):
os.remove(video_name)
if ret:

View File

@ -34,7 +34,7 @@ class Run_ERC(BasePreFlight): # noqa: F821
load_sch()
out_pattern = GS.global_output if GS.global_output is not None else GS.def_global_output
name = Optionable.expand_filename_sch(self, out_pattern)
return [os.path.abspath(os.path.join(Optionable.expand_filename_sch(self, GS.out_dir), name))]
return [os.path.abspath(os.path.join(self.expand_dirname(GS.out_dir), name))]
def run(self):
check_eeschema_do()
@ -47,13 +47,13 @@ class Run_ERC(BasePreFlight): # noqa: F821
cmd.append('-w')
if GS.filter_file:
cmd.extend(['-f', GS.filter_file])
cmd.extend([GS.sch_file, Optionable.expand_filename_sch(self, GS.out_dir)])
cmd.extend([GS.sch_file, self.expand_dirname(GS.out_dir)])
# If we are in verbose mode enable debug in the child
cmd, video_remove = add_extra_options(cmd)
logger.info('- Running the ERC')
ret = exec_with_retry(cmd)
if video_remove:
video_name = os.path.join(Optionable.expand_filename_sch(self, GS.out_dir), 'run_erc_eeschema_screencast.ogv')
video_name = os.path.join(self.expand_dirname(GS.out_dir), 'run_erc_eeschema_screencast.ogv')
if os.path.isfile(video_name):
os.remove(video_name)
if ret:

View File

@ -8,7 +8,6 @@ from sys import (exit)
from .macros import macros, pre_class # noqa: F401
from .error import (KiPlotConfigurationError)
from .gs import (GS)
from .optionable import Optionable
from .kiplot import check_eeschema_do, exec_with_retry, add_extra_options
from .misc import (CMD_EESCHEMA_DO, BOM_ERROR)
from .log import (get_logger)
@ -34,7 +33,7 @@ class Update_XML(BasePreFlight): # noqa: F821
def run(self):
check_eeschema_do()
cmd = [CMD_EESCHEMA_DO, 'bom_xml', GS.sch_file, Optionable.expand_filename_sch(self, GS.out_dir)]
cmd = [CMD_EESCHEMA_DO, 'bom_xml', GS.sch_file, self.expand_dirname(GS.out_dir)]
# If we are in verbose mode enable debug in the child
cmd, video_remove = add_extra_options(cmd)
logger.info('- Updating BoM in XML format')
@ -43,6 +42,6 @@ class Update_XML(BasePreFlight): # noqa: F821
logger.error('Failed to update the BoM, error %d', ret)
exit(BOM_ERROR)
if video_remove:
video_name = os.path.join(Optionable.expand_filename_sch(self, GS.out_dir), 'bom_xml_eeschema_screencast.ogv')
video_name = os.path.join(self.expand_dirname(GS.out_dir), 'bom_xml_eeschema_screencast.ogv')
if os.path.isfile(video_name):
os.remove(video_name)