Added %X expansion to the set_text_variables
This commit is contained in:
parent
1824d56876
commit
2d86f9516d
|
|
@ -36,6 +36,8 @@ class KiCadVariable(Optionable):
|
|||
""" Text to add before the output of `command` """
|
||||
self.after = ''
|
||||
""" Text to add after the output of `command` """
|
||||
self.expand_kibot_patterns = True
|
||||
""" Expand %X patterns. The context is `schematic` """
|
||||
|
||||
def config(self, parent):
|
||||
super().config(parent)
|
||||
|
|
@ -110,6 +112,8 @@ class Set_Text_Variables(BasePreFlight): # noqa: F821
|
|||
continue
|
||||
text = result.stdout.strip()
|
||||
text = r.before + text + r.after
|
||||
if r.expand_kibot_patterns:
|
||||
text = Optionable.expand_filename_both(self, text, make_safe=False)
|
||||
logger.debug(' - ' + r.name + ' -> ' + text)
|
||||
text_variables[r.name] = text
|
||||
logger.debug("- New list of variables: {}".format(text_variables))
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ def test_set_text_variables_1(test_dir):
|
|||
try:
|
||||
logging.debug(file)
|
||||
cmd = ['/bin/bash', '-c', "git log -1 --format='%h' " + ctx.board_file]
|
||||
text = "Git_hash:'" + run(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True).stdout.strip() + "'"
|
||||
text = "Git_hash:'" + run(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True).stdout.strip() + "' ({})".format(prj)
|
||||
with open(file, 'rt') as f:
|
||||
c = f.read()
|
||||
data = json.loads(c)
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ preflight:
|
|||
- variable: "Comment4"
|
||||
command: git log -1 --format="%h" $KIBOT_PCB_NAME
|
||||
before: "Git_hash:'"
|
||||
after: "'"
|
||||
after: "' (%f)"
|
||||
|
|
|
|||
Loading…
Reference in New Issue