Merge branch 'dev' into kiri_integration
This commit is contained in:
commit
d8f3b45d7c
|
|
@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [1.6.4] - UNRELEASED
|
||||
### Added
|
||||
- General:
|
||||
- Operations that copies the project now also copies the PRL
|
||||
- Command line:
|
||||
- `--help-list-offsets` to list footprint offsets (JLCPCB)
|
||||
- `--help-list-rotations` to list footprint rotations (JLCPCB)
|
||||
|
|
@ -16,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- `layer_defaults` to specify the default suffix and description. (#504)
|
||||
- `include_components_from_pcb` to disable the new behavior that includes
|
||||
components from the PCB in the filter/variants processing
|
||||
- `restore_project` now also restores the PRL
|
||||
- Schematic format:
|
||||
- Support for *unit names* (#513)
|
||||
- Internal templates:
|
||||
|
|
@ -114,6 +117,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- QR Lib:
|
||||
- When used from the preflight the name of the file changed to the name of a
|
||||
temporal, generating problems with the plot outputs, like pcb_print
|
||||
- Project options not preserved, i.e. set_text_variables failing
|
||||
|
||||
|
||||
## [1.6.3] - 2023-06-26
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ preflight:
|
|||
# If you need to check the parity use the `update_xml` preflight.
|
||||
# KiCad 6 introduced `warnings` they are currently counted be the `unconnected` counter of KiBot.
|
||||
# This will change in the future.
|
||||
# If you use DRC exclusions please consult the `drc_exclusions_workaround` global option.
|
||||
run_drc: true
|
||||
# [boolean=false] Runs the ERC (Electrical Rules Check). To ensure the schematic is electrically correct.
|
||||
# The report file name is controlled by the global output pattern (%i=erc %x=txt).
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@
|
|||
which is used by the KiBot docker images, on other OSs *your mileage may vary*.
|
||||
- ``restore_project`` :index:`: <pair: global options; restore_project>` [boolean=false] Restore the KiCad project after execution.
|
||||
Note that this option will undo operations like `set_text_variables`.
|
||||
Starting with 1.6.4 it also restores the PRL (Project Local Settings) file.
|
||||
- ``set_text_variables_before_output`` :index:`: <pair: global options; set_text_variables_before_output>` [boolean=false] Run the `set_text_variables` preflight before running each output that involves variants.
|
||||
This can be used when a text variable uses the variant and you want to create more than
|
||||
one variant in the same run. Note that this could be slow because it forces a board
|
||||
|
|
|
|||
|
|
@ -84,7 +84,8 @@ Supported preflights
|
|||
Note that the KiCad 6+ *Test for parity between PCB and schematic* option is not supported. |br|
|
||||
If you need to check the parity use the `update_xml` preflight. |br|
|
||||
KiCad 6 introduced `warnings` they are currently counted be the `unconnected` counter of KiBot. |br|
|
||||
This will change in the future.
|
||||
This will change in the future. |br|
|
||||
If you use DRC exclusions please consult the `drc_exclusions_workaround` global option.
|
||||
- **run_erc**: :index:`: <pair: preflights; run_erc>` [boolean=false] Runs the ERC (Electrical Rules Check). To ensure the schematic is electrically correct.
|
||||
The report file name is controlled by the global output pattern (%i=erc %x=txt).
|
||||
- **sch_replace**: :index:`: <pair: preflights; sch_replace>` [dict] Replaces tags in the schematic. I.e. to insert the git hash or last revision date.
|
||||
|
|
|
|||
|
|
@ -238,7 +238,8 @@ class Globals(FiltersOptions):
|
|||
""" When applying filters and variants remove the solder mask apertures for components that won't be included """
|
||||
self.restore_project = False
|
||||
""" Restore the KiCad project after execution.
|
||||
Note that this option will undo operations like `set_text_variables` """
|
||||
Note that this option will undo operations like `set_text_variables`.
|
||||
Starting with 1.6.4 it also restores the PRL (Project Local Settings) file """
|
||||
self.set_text_variables_before_output = False
|
||||
""" Run the `set_text_variables` preflight before running each output that involves variants.
|
||||
This can be used when a text variable uses the variant and you want to create more than
|
||||
|
|
|
|||
44
kibot/gs.py
44
kibot/gs.py
|
|
@ -243,17 +243,29 @@ class GS(object):
|
|||
|
||||
@staticmethod
|
||||
def read_pro():
|
||||
if GS.pro_file:
|
||||
# Note: We use binary mode to preserve the original end of lines
|
||||
# Otherwise git could see changes in the file
|
||||
with open(GS.pro_file, 'rb') as f:
|
||||
return f.read()
|
||||
if not GS.pro_file:
|
||||
return None
|
||||
# Note: We use binary mode to preserve the original end of lines
|
||||
# Otherwise git could see changes in the file
|
||||
with open(GS.pro_file, 'rb') as f:
|
||||
pro = f.read()
|
||||
prl_name = GS.pro_file[:-3]+'prl'
|
||||
prl = None
|
||||
if os.path.isfile(prl_name):
|
||||
with open(prl_name, 'rb') as f:
|
||||
prl = f.read()
|
||||
return (pro, prl)
|
||||
|
||||
@staticmethod
|
||||
def write_pro(prj):
|
||||
if GS.pro_file and prj:
|
||||
with open(GS.pro_file, 'wb') as f:
|
||||
f.write(prj)
|
||||
def write_pro(data):
|
||||
if not GS.pro_file or data is None:
|
||||
return
|
||||
with open(GS.pro_file, 'wb') as f:
|
||||
f.write(data[0])
|
||||
if data[1] is None:
|
||||
return
|
||||
with open(GS.pro_file[:-3]+'prl', 'wb') as f:
|
||||
f.write(data[1])
|
||||
|
||||
@staticmethod
|
||||
def load_sch_title_block():
|
||||
|
|
@ -468,12 +480,20 @@ class GS(object):
|
|||
def copy_project(new_pcb_name, dry=False):
|
||||
pro_name = GS.pro_file
|
||||
if pro_name is None or not os.path.isfile(pro_name):
|
||||
return None
|
||||
return None, None
|
||||
pro_copy = new_pcb_name.replace('.kicad_pcb', GS.pro_ext)
|
||||
if not dry:
|
||||
logger.debug('Copying project `{}` to `{}`'.format(pro_name, pro_copy))
|
||||
logger.debug(f'Copying project `{pro_name}` to `{pro_copy}`')
|
||||
copy2(pro_name, pro_copy)
|
||||
return pro_copy
|
||||
# Also copy the PRL
|
||||
prl_name = pro_name[:-3]+'prl'
|
||||
prl_copy = None
|
||||
if os.path.isfile(prl_name):
|
||||
prl_copy = pro_copy[:-3]+'prl'
|
||||
if not dry:
|
||||
logger.debug(f'Copying project local settings `{prl_name}` to `{prl_copy}`')
|
||||
copy2(prl_name, prl_copy)
|
||||
return pro_copy, prl_copy
|
||||
|
||||
@staticmethod
|
||||
def copy_project_sch(sch_dir):
|
||||
|
|
|
|||
|
|
@ -930,7 +930,7 @@ class VariantOptions(BaseOptions):
|
|||
fname = os.path.join(pcb_dir, basename+'.kicad_pcb')
|
||||
logger.debug('Storing modified PCB to `{}`'.format(fname))
|
||||
GS.board.Save(fname)
|
||||
pro_name = GS.copy_project(fname)
|
||||
pro_name, _ = GS.copy_project(fname)
|
||||
KiConf.fix_page_layout(pro_name)
|
||||
return fname, pcb_dir
|
||||
|
||||
|
|
|
|||
|
|
@ -178,6 +178,9 @@ class Copy_FilesOptions(Base3DOptions):
|
|||
else:
|
||||
# Create the libs
|
||||
for lib, comps in libs.items():
|
||||
if lib == 'locally_edited':
|
||||
# Not from a lib, just a copy inside the SCH
|
||||
continue
|
||||
GS.sch.write_lib(out_lib_base, lib, comps)
|
||||
new_alias = LibAlias()
|
||||
new_alias.name = lib
|
||||
|
|
@ -232,11 +235,13 @@ class Copy_FilesOptions(Base3DOptions):
|
|||
self.add_sch_files(extra_files, dest_dir)
|
||||
elif mode_project:
|
||||
self.add_sch_files(extra_files, dest_dir)
|
||||
prj_name = GS.copy_project(fname, dry)
|
||||
prj_name, prl_name = GS.copy_project(fname, dry)
|
||||
# Extra files that we are generating
|
||||
extra_files.append(fname)
|
||||
if prj_name:
|
||||
extra_files.append(prj_name)
|
||||
if prl_name:
|
||||
extra_files.append(prl_name)
|
||||
if mode_project:
|
||||
extra_files += self.copy_footprints(f.dest, dry)
|
||||
extra_files += self.copy_symbols(f.dest, dry)
|
||||
|
|
|
|||
|
|
@ -398,6 +398,8 @@ class QR_LibOptions(BaseOptions):
|
|||
f.write(dumps(separated))
|
||||
f.write('\n')
|
||||
tmp_pcb = f.name
|
||||
# Also copy the project
|
||||
GS.copy_project(tmp_pcb)
|
||||
# Reload it
|
||||
logger.debug('- Loading the temporal PCB')
|
||||
load_board(tmp_pcb, forced=True)
|
||||
|
|
@ -405,19 +407,9 @@ class QR_LibOptions(BaseOptions):
|
|||
logger.debug('- Replacing the old PCB')
|
||||
os.remove(tmp_pcb)
|
||||
GS.make_bkp(GS.pcb_file)
|
||||
prl = None
|
||||
if GS.ki6:
|
||||
# KiCad 6 is destroying the PRL ...
|
||||
prl_name = GS.pcb_no_ext+'.kicad_prl'
|
||||
if os.path.isfile(prl_name):
|
||||
with open(prl_name, 'rt') as f:
|
||||
prl = f.read()
|
||||
GS.board.Save(GS.pcb_file)
|
||||
# After saving the file the name isn't changed, we must force it!!!
|
||||
GS.board.SetFileName(GS.pcb_file)
|
||||
if prl:
|
||||
with open(prl_name, 'wt') as f:
|
||||
f.write(prl)
|
||||
|
||||
def update_symbol(self, name, c_name, sexp, qr):
|
||||
logger.debug('- Updating QR symbol: '+name)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ class Run_DRC(BasePreFlight): # noqa: F821
|
|||
Note that the KiCad 6+ *Test for parity between PCB and schematic* option is not supported.
|
||||
If you need to check the parity use the `update_xml` preflight.
|
||||
KiCad 6 introduced `warnings` they are currently counted be the `unconnected` counter of KiBot.
|
||||
This will change in the future """
|
||||
This will change in the future.
|
||||
If you use DRC exclusions please consult the `drc_exclusions_workaround` global option """
|
||||
def __init__(self, name, value):
|
||||
super().__init__(name, value)
|
||||
if not isinstance(value, bool):
|
||||
|
|
|
|||
Loading…
Reference in New Issue