diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ba536407..d0ab3761f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.8.3] - UNRELEASED ### Added +- Workaround for people using backslashes (i.e. Windows+WSL) (#719) (#607) + More general than in previous versions. - Global options: - `work_layer`: to choose the temporal layer for internal operations (#713) - BoM: diff --git a/docs/source/Changelog.rst b/docs/source/Changelog.rst index e67aa43a1..5fbb74478 100644 --- a/docs/source/Changelog.rst +++ b/docs/source/Changelog.rst @@ -19,6 +19,8 @@ Versioning `__. Added ~~~~~ +- Workaround for people using backslashes (i.e. Windows+WSL) (#719) + (#607) More general than in previous versions. - Global options: - ``work_layer``: to choose the temporal layer for internal @@ -43,6 +45,11 @@ Added - ``use_ref_ranges`` alias for ``use_alt`` - New *kicad* format to mimic KiCad’s internal BoM. +- Drill: + + - Option to don’t generate the drill files, so you can generate only + the maps (#720) + - PCB Print: a mechanism to filter components for a particular layer (#706) - SCH Variant and \*SCH Print: diff --git a/kibot/kicad/config.py b/kibot/kicad/config.py index 8722d0b21..d10cab8f7 100644 --- a/kibot/kicad/config.py +++ b/kibot/kicad/config.py @@ -80,6 +80,15 @@ def parse_len_str(val): return value +def fix_windows(name): + if not os.path.isfile(name): + fixed = name.replace('\\', '/') + if os.path.isfile(fixed): + logger.debug(f'Fixing windows path: {name} -> {fixed}') + return fixed + return name + + def expand_env(val, env, extra_env, used_extra=None): """ Expand KiCad environment variables """ if used_extra is None: @@ -630,7 +639,7 @@ def fix_page_layout_k6_key(key, data, dest_dir, forced): section = data[key] pl = section.get('page_layout_descr_file', None) if not forced else forced if pl: - fname = KiConf.expand_env(pl) + fname = fix_windows(KiConf.expand_env(pl)) if os.path.isfile(fname): dest = os.path.join(dest_dir, key+'.kicad_wks') logger.debug('Copying {} -> {}'.format(fname, dest)) @@ -658,10 +667,10 @@ def fix_page_layout_k6(project, dry, force_sch, force_pcb): else: aux = data.get('schematic', None) if aux: - layouts[0] = KiConf.expand_env(aux.get('page_layout_descr_file', None), ref_dir=dest_dir) + layouts[0] = fix_windows(KiConf.expand_env(aux.get('page_layout_descr_file', None), ref_dir=dest_dir)) aux = data.get('pcbnew', None) if aux: - layouts[1] = KiConf.expand_env(aux.get('page_layout_descr_file', None), ref_dir=dest_dir) + layouts[1] = fix_windows(KiConf.expand_env(aux.get('page_layout_descr_file', None), ref_dir=dest_dir)) return layouts def fix_page_layout_k5(project, dry, force_sch, force_pcb): @@ -683,7 +692,7 @@ def fix_page_layout_k5(project, dry, force_sch, force_pcb): elif force_pcb and is_pcb_new: dest = force_pcb elif fname: - fname = KiConf.expand_env(fname) + fname = fix_windows(KiConf.expand_env(fname)) if os.path.isfile(fname): dest = os.path.join(dest_dir, str(order)+'.kicad_wks') if not dry: diff --git a/kibot/out_any_sch_print.py b/kibot/out_any_sch_print.py index 23e0a2e7c..74e5f56f3 100644 --- a/kibot/out_any_sch_print.py +++ b/kibot/out_any_sch_print.py @@ -66,11 +66,7 @@ def run(self, name): else: ori_wks = new_wks = wks[0] if ori_wks and not os.path.isfile(new_wks): - # Try replacing backslashes - try_wks = new_wks.replace('\\', '/') - if not os.path.isfile(try_wks): - raise KiPlotConfigurationError(f'Missing `{new_wks}` worksheet') - new_wks = try_wks + raise KiPlotConfigurationError(f'Missing `{new_wks}` worksheet') if ori_wks != new_wks: prj = GS.read_pro() GS.fix_page_layout(GS.pro_file, dry=False, force_sch=os.path.relpath(new_wks, GS.pro_dir),