Update XML: Removed the side effect Bom.

Related to #106
This commit is contained in:
Salvador E. Tropea 2021-12-30 13:12:00 -03:00
parent e5f910bc6d
commit 4b3636313c
2 changed files with 9 additions and 1 deletions

View File

@ -86,6 +86,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Compress: not expanding %VALUES in target dirs. (#111)
- Gerber: job file didn't use the global output pattern. (#116)
- Warnings count
- Update XML: Removed the side effect Bom. (#106)
## [0.11.0] - 2021-04-25

View File

@ -33,11 +33,18 @@ class Update_XML(BasePreFlight): # noqa: F821
def run(self):
check_eeschema_do()
cmd = [CMD_EESCHEMA_DO, 'bom_xml', GS.sch_file, self.expand_dirname(GS.out_dir)]
out_dir = self.expand_dirname(GS.out_dir)
cmd = [CMD_EESCHEMA_DO, 'bom_xml', GS.sch_file, out_dir]
# If we are in verbose mode enable debug in the child
cmd, video_remove = add_extra_options(cmd)
# While creating the XML we run a BoM plug-in that creates a useless BoM
# We remove it, unless this is already there
side_effect_file = os.path.join(out_dir, GS.sch_basename+'.csv')
remove_side_effect_file = not os.path.isfile(side_effect_file)
logger.info('- Updating BoM in XML format')
ret = exec_with_retry(cmd)
if remove_side_effect_file and os.path.isfile(side_effect_file):
os.remove(side_effect_file)
if ret:
logger.error('Failed to update the BoM, error %d', ret)
exit(BOM_ERROR)