Added option to export old variables
- When using the global/environment
This commit is contained in:
parent
e0fa00f68b
commit
3eaf9c025e
|
|
@ -611,6 +611,8 @@ global:
|
||||||
You can make reference to any OS environment variable using ${VARIABLE}.
|
You can make reference to any OS environment variable using ${VARIABLE}.
|
||||||
The KIPRJMOD is also available for expansion.
|
The KIPRJMOD is also available for expansion.
|
||||||
* Valid keys:
|
* Valid keys:
|
||||||
|
- `define_old`: [boolean=false] Also define legacy versions of the variables.
|
||||||
|
Useful when using KiCad 6 and some libs uses old KiCad 5 names.
|
||||||
- `footprints`: [string=''] System level footprints (aka modules) dir. KiCad 5: KICAD_FOOTPRINT_DIR and KISYSMOD.
|
- `footprints`: [string=''] System level footprints (aka modules) dir. KiCad 5: KICAD_FOOTPRINT_DIR and KISYSMOD.
|
||||||
KiCad 6: KICAD6_FOOTPRINT_DIR.
|
KiCad 6: KICAD6_FOOTPRINT_DIR.
|
||||||
- `models_3d`: [string=''] System level 3D models dir. KiCad 5: KISYS3DMOD. KiCad 6: KICAD6_3DMODEL_DIR.
|
- `models_3d`: [string=''] System level 3D models dir. KiCad 5: KISYS3DMOD. KiCad 6: KICAD6_3DMODEL_DIR.
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ all: ../README.md samples/generic_plot.kibot.yaml ../kibot/report_templates/rep
|
||||||
../kibot/config_templates/bom/%.kibot.yaml: samples/%.kibot.yaml
|
../kibot/config_templates/bom/%.kibot.yaml: samples/%.kibot.yaml
|
||||||
cp $< $@
|
cp $< $@
|
||||||
|
|
||||||
../README.md: README.in replace_tags.pl ../kibot/out_*.py ../kibot/pre_*.py ../kibot/fil_*.py ../kibot/__main__.py ../kibot/config_reader.py
|
../README.md: README.in replace_tags.pl ../kibot/out_*.py ../kibot/pre_*.py ../kibot/fil_*.py ../kibot/__main__.py ../kibot/config_reader.py ../kibot/globals.py
|
||||||
cat README.in | perl replace_tags.pl > ../README.md
|
cat README.in | perl replace_tags.pl > ../README.md
|
||||||
|
|
||||||
../src/kibot-check: ../src/kibot-check.in replace_tags.pl ../kibot/out_*.py ../kibot/pre_*.py ../kibot/registrable.py ../kibot/misc.py ../kibot/config_reader.py
|
../src/kibot-check: ../src/kibot-check.in replace_tags.pl ../kibot/out_*.py ../kibot/pre_*.py ../kibot/registrable.py ../kibot/misc.py ../kibot/config_reader.py
|
||||||
|
|
|
||||||
|
|
@ -34,35 +34,46 @@ class Environment(Optionable):
|
||||||
""" User level templates dir. KiCad 5/6: KICAD_USER_TEMPLATE_DIR """
|
""" User level templates dir. KiCad 5/6: KICAD_USER_TEMPLATE_DIR """
|
||||||
self.third_party = ''
|
self.third_party = ''
|
||||||
""" 3rd party dir. KiCad 6: KICAD6_3RD_PARTY """
|
""" 3rd party dir. KiCad 6: KICAD6_3RD_PARTY """
|
||||||
|
self.define_old = False
|
||||||
|
""" Also define legacy versions of the variables.
|
||||||
|
Useful when using KiCad 6 and some libs uses old KiCad 5 names """
|
||||||
|
|
||||||
|
def define_k5_vars(self, defs):
|
||||||
|
if self.symbols:
|
||||||
|
defs['KICAD_SYMBOL_DIR'] = self.symbols
|
||||||
|
if self.footprints:
|
||||||
|
defs['KICAD_FOOTPRINT_DIR'] = self.symbols
|
||||||
|
defs['KISYSMOD'] = self.symbols
|
||||||
|
if self.models_3d:
|
||||||
|
defs['KISYS3DMOD'] = self.models_3d
|
||||||
|
if self.templates:
|
||||||
|
defs['KICAD_TEMPLATE_DIR'] = self.templates
|
||||||
|
if self.user_templates:
|
||||||
|
defs['KICAD_USER_TEMPLATE_DIR'] = self.user_templates
|
||||||
|
|
||||||
|
def define_k6_vars(self, defs):
|
||||||
|
if self.symbols:
|
||||||
|
defs['KICAD6_SYMBOL_DIR'] = self.symbols
|
||||||
|
if self.footprints:
|
||||||
|
defs['KICAD6_FOOTPRINT_DIR'] = self.symbols
|
||||||
|
if self.models_3d:
|
||||||
|
defs['KICAD6_3DMODEL_DIR'] = self.models_3d
|
||||||
|
if self.templates:
|
||||||
|
defs['KICAD6_TEMPLATE_DIR'] = self.templates
|
||||||
|
if self.user_templates:
|
||||||
|
defs['KICAD_USER_TEMPLATE_DIR'] = self.user_templates
|
||||||
|
if self.third_party:
|
||||||
|
defs['KICAD6_3RD_PARTY'] = self.third_party
|
||||||
|
|
||||||
def config(self, parent):
|
def config(self, parent):
|
||||||
super().config(parent)
|
super().config(parent)
|
||||||
defs = {}
|
defs = {}
|
||||||
if GS.ki5():
|
if GS.ki5():
|
||||||
if self.symbols:
|
self.define_k5_vars(defs)
|
||||||
defs['KICAD_SYMBOL_DIR'] = self.symbols
|
|
||||||
if self.footprints:
|
|
||||||
defs['KICAD_FOOTPRINT_DIR'] = self.symbols
|
|
||||||
defs['KISYSMOD'] = self.symbols
|
|
||||||
if self.models_3d:
|
|
||||||
defs['KISYS3DMOD'] = self.models_3d
|
|
||||||
if self.templates:
|
|
||||||
defs['KICAD_TEMPLATE_DIR'] = self.templates
|
|
||||||
if self.user_templates:
|
|
||||||
defs['KICAD_USER_TEMPLATE_DIR'] = self.user_templates
|
|
||||||
else:
|
else:
|
||||||
if self.symbols:
|
self.define_k6_vars(defs)
|
||||||
defs['KICAD6_SYMBOL_DIR'] = self.symbols
|
if self.define_old:
|
||||||
if self.footprints:
|
self.define_k5_vars(defs)
|
||||||
defs['KICAD6_FOOTPRINT_DIR'] = self.symbols
|
|
||||||
if self.models_3d:
|
|
||||||
defs['KICAD6_3DMODEL_DIR'] = self.models_3d
|
|
||||||
if self.templates:
|
|
||||||
defs['KICAD6_TEMPLATE_DIR'] = self.templates
|
|
||||||
if self.user_templates:
|
|
||||||
defs['KICAD_USER_TEMPLATE_DIR'] = self.user_templates
|
|
||||||
if self.third_party:
|
|
||||||
defs['KICAD6_3RD_PARTY'] = self.third_party
|
|
||||||
if len(defs):
|
if len(defs):
|
||||||
logger.debug('Defining environment vars from the global section')
|
logger.debug('Defining environment vars from the global section')
|
||||||
env = {}
|
env = {}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue