Skip to content

Commit cbdfc8c

Browse files
committed
[Fix] To support older rsvg-convert tools
We have a 2.26.3 as downloadable fallback, so now we catch errors about unsupported --unlimited and retry without it.
1 parent b96d90e commit cbdfc8c

File tree

6 files changed

+34
-46
lines changed

6 files changed

+34
-46
lines changed

docs/source/dependencies.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,17 @@
8989
- Find commit hash and/or date for `sch_replace`
9090
- Find commit hash and/or date for `set_text_variables`
9191

92-
`RSVG tools <https://gitlab.gnome.org/GNOME/librsvg>`__ :index:`: <pair: dependency; RSVG tools>` v2.40.3 |image37| |image38| |Auto-download|
92+
`RSVG tools <https://gitlab.gnome.org/GNOME/librsvg>`__ :index:`: <pair: dependency; RSVG tools>` |image37| |image38| |Auto-download|
9393

9494
- Optional to:
9595

96-
- SVG logos for the BoM for `bom` (v2.40.3)
97-
- Create outputs preview for `navigate_results` (v2.40.3)
98-
- Create PNG icons for `navigate_results` (v2.40.3)
99-
- Create outputs preview for `navigate_results_rb` (v2.40.3)
100-
- Create PNG icons for `navigate_results_rb` (v2.40.3)
101-
- Create PDF, PNG, PS and EPS formats for `pcb_print` (v2.40.3)
102-
- Create PNG, JPG and BMP images for `pcbdraw` (v2.40.3)
96+
- SVG logos for the BoM for `bom`
97+
- Create outputs preview for `navigate_results`
98+
- Create PNG icons for `navigate_results`
99+
- Create outputs preview for `navigate_results_rb`
100+
- Create PNG icons for `navigate_results_rb`
101+
- Create PDF, PNG, PS and EPS formats for `pcb_print`
102+
- Create PNG, JPG and BMP images for `pcbdraw`
103103

104104
`ImageMagick <https://imagemagick.org/>`__ :index:`: <pair: dependency; ImageMagick>` |image39| |image40| |Auto-download|
105105

kibot/dep_downloader.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
arch: librsvg
4141
command: rsvg-convert
4242
downloader: rsvg
43-
version: 2.40.3
4443
id: RSVG
4544
tests:
4645
- command: [convert, -list, font]

kibot/out_any_navigate_results.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ def _run_command(cmd):
105105
cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
106106
except subprocess.CalledProcessError as e:
107107
odecoded = e.output.decode() if e.output else None
108+
if '--unlimited' in odecoded:
109+
cmd.remove('--unlimited')
110+
return _run_command(cmd)
108111
if odecoded:
109112
logger.debug('Output from command: '+odecoded)
110113
logger.non_critical_error(f'Failed to run {cmd[0]}, error {e.returncode}')

kibot/out_pcb_print.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import importlib
3939
from pcbnew import B_Cu, B_Mask, F_Cu, F_Mask, FromMM, IsCopperLayer, LSET, PLOT_CONTROLLER, PLOT_FORMAT_SVG
4040
from shutil import rmtree, copy2
41+
from subprocess import CalledProcessError
4142
import sys
4243
from .error import KiPlotConfigurationError
4344
from .fil_base import BaseFilter, apply_exclude_filter
@@ -93,7 +94,13 @@ def pcbdraw_warnings(tag, msg):
9394

9495

9596
def _run_command(cmd):
96-
run_command(cmd, err_lvl=PDF_PCB_PRINT)
97+
try:
98+
run_command(cmd, err_lvl=PDF_PCB_PRINT, just_raise=True)
99+
except CalledProcessError as e:
100+
output = e.stdout or e.stderr
101+
if '--unlimited' in output.decode():
102+
cmd.remove('--unlimited')
103+
return run_command(cmd, err_lvl=PDF_PCB_PRINT)
97104

98105

99106
def hex_to_rgb(value):

kibot/out_pcbdraw.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
if PROFILE_PLOT:
2323
import cProfile
2424
import os
25+
from subprocess import CalledProcessError
2526
# Here we import the whole module to make monkeypatch work
2627
from .error import KiPlotConfigurationError
2728
from .kiplot import load_sch, get_board_comps_data, run_command
@@ -46,7 +47,13 @@ def pcbdraw_warnings(tag, msg):
4647

4748

4849
def _run_command(cmd):
49-
run_command(cmd, err_lvl=PCBDRAW_ERR)
50+
try:
51+
run_command(cmd, err_lvl=PCBDRAW_ERR, just_raise=True)
52+
except CalledProcessError as e:
53+
output = e.stdout or e.stderr
54+
if '--unlimited' in output.decode():
55+
cmd.remove('--unlimited')
56+
return run_command(cmd, err_lvl=PCBDRAW_ERR)
5057

5158

5259
class PcbDrawStyle(Optionable):

src/kibot-check

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,83 +1211,55 @@ deps = '{\
12111211
"mandatory": false,\
12121212
"max_version": null,\
12131213
"output": "bom",\
1214-
"version": [\
1215-
2,\
1216-
40,\
1217-
3\
1218-
]\
1214+
"version": null\
12191215
},\
12201216
{\
12211217
"all_versions": {},\
12221218
"desc": "Create outputs preview",\
12231219
"mandatory": false,\
12241220
"max_version": null,\
12251221
"output": "navigate_results",\
1226-
"version": [\
1227-
2,\
1228-
40,\
1229-
3\
1230-
]\
1222+
"version": null\
12311223
},\
12321224
{\
12331225
"all_versions": {},\
12341226
"desc": "Create PNG icons",\
12351227
"mandatory": false,\
12361228
"max_version": null,\
12371229
"output": "navigate_results",\
1238-
"version": [\
1239-
2,\
1240-
40,\
1241-
3\
1242-
]\
1230+
"version": null\
12431231
},\
12441232
{\
12451233
"all_versions": {},\
12461234
"desc": "Create outputs preview",\
12471235
"mandatory": false,\
12481236
"max_version": null,\
12491237
"output": "navigate_results_rb",\
1250-
"version": [\
1251-
2,\
1252-
40,\
1253-
3\
1254-
]\
1238+
"version": null\
12551239
},\
12561240
{\
12571241
"all_versions": {},\
12581242
"desc": "Create PNG icons",\
12591243
"mandatory": false,\
12601244
"max_version": null,\
12611245
"output": "navigate_results_rb",\
1262-
"version": [\
1263-
2,\
1264-
40,\
1265-
3\
1266-
]\
1246+
"version": null\
12671247
},\
12681248
{\
12691249
"all_versions": {},\
12701250
"desc": "Create PDF, PNG, PS and EPS formats",\
12711251
"mandatory": false,\
12721252
"max_version": null,\
12731253
"output": "pcb_print",\
1274-
"version": [\
1275-
2,\
1276-
40,\
1277-
3\
1278-
]\
1254+
"version": null\
12791255
},\
12801256
{\
12811257
"all_versions": {},\
12821258
"desc": "Create PNG, JPG and BMP images",\
12831259
"mandatory": false,\
12841260
"max_version": null,\
12851261
"output": "pcbdraw",\
1286-
"version": [\
1287-
2,\
1288-
40,\
1289-
3\
1290-
]\
1262+
"version": null\
12911263
}\
12921264
],\
12931265
"tests": [\

0 commit comments

Comments
 (0)