From 4b3636313ccde203c02666b01f932a686eeb8b29 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Thu, 30 Dec 2021 13:12:00 -0300 Subject: [PATCH] Update XML: Removed the side effect Bom. Related to #106 --- CHANGELOG.md | 1 + kibot/pre_update_xml.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ebbc0eb..bd581a4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/kibot/pre_update_xml.py b/kibot/pre_update_xml.py index ff99f26d..e8f90ada 100644 --- a/kibot/pre_update_xml.py +++ b/kibot/pre_update_xml.py @@ -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)