Skip to content

Commit cb56967

Browse files
committed
web generator: display fuller error messages
update release CI to python 3.9
1 parent 31bb3ed commit cb56967

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
env:
1111
GITHUB_CONTEXT: ${{ toJson(github) }}
1212
run: echo "$GITHUB_CONTEXT"
13-
- name: Set up Python 3.7
13+
- name: Set up Python 3.9
1414
uses: actions/setup-python@v1
1515
with:
16-
python-version: 3.7
16+
python-version: 3.9
1717
- name: Versions
1818
run: |
1919
python3 --version

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
env:
1313
GITHUB_CONTEXT: ${{ toJson(github) }}
1414
run: echo "$GITHUB_CONTEXT"
15-
- name: Set up Python 3.7
15+
- name: Set up Python 3.9
1616
uses: actions/setup-python@v1
1717
with:
18-
python-version: 3.7
18+
python-version: 3.9
1919
- name: Versions
2020
run: |
2121
python3 --version

generator-web/make_zip_bundle.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
$source_url = strtolower($source_url);
3838

3939
if( preg_match(",^https://kbdlayout.info/kbd([a-zA-Z0-9_-]+)$,", $source_url, $m) ) {
40-
$filepath_xml = "data/kbdlaytout-info-" . $m[1] . ".xml";
40+
$filepath_xml = "data/kbdlayout-info-" . $m[1] . ".xml";
4141
$fileurl = $source_url . "/download/xml";
4242

4343
if( $lang == "") {
@@ -57,22 +57,27 @@
5757
} else {
5858
# other platforms or sources
5959
header("HTTP/1.1 500 Internal Server Error");
60-
print("The source could not be interpreted, or is not supported, check the spelling.");
60+
print("<pre>The source could not be interpreted, or is not supported, check the spelling.\n".htmlentities($source_url)."</pre>");
6161
exit(0);
6262
}
6363

6464
$layout_out = array();
65-
exec("python3 -m generator -k ".$filepath_xml." -v layout", $layout_out, $result_code);
65+
$layout_command = "python3 -m generator --keyboard ".$filepath_xml." -v layout";
66+
exec($layout_command, $layout_out, $result_code);
6667
$layout = join("\n", $layout_out);
6768
if($result_code != 0) { $ERRORS[] = "Error Layout\n"; }
6869

6970
$layout = preg_replace("/".preg_quote($VERSION0)."/", $VERSION, $layout);
7071

7172
$keycodes_out = array();
72-
exec("python3 -m generator -k ".$filepath_xml." -v keycode", $keycodes_out, $result_code);
73+
$keycodes_command = "python3 -m generator --keyboard ".$filepath_xml." -v keycode";
74+
exec($keycodes_command, $keycodes_out, $result_code);
7375
$keycodes = join("\n", $keycodes_out);
7476
if($result_code != 0) { $ERRORS[] = "Error Keycodes\n"; }
7577

78+
# $ERRORS[] = $layout_command;
79+
# $ERRORS[] = $keycodes_command;
80+
7681
$keycodes = preg_replace("/".preg_quote($VERSION0)."/", $VERSION, $keycodes);
7782

7883
if( !file_exists("src/keyboard_layout6.mpy") ) {
@@ -173,7 +178,12 @@ function make_zip($layout, $keycodes, $cpversion, $platform, $lang) {
173178

174179
if( count($ERRORS) > 0 ) {
175180
header("HTTP/1.1 500 Internal Server Error");
176-
print("The source could not be interpreted, or is not supported, check the spelling.");
181+
print("<pre>\n");
182+
print("The source could not be interpreted, or is not supported, check the spelling.\n");
183+
print(htmlentities($source_url)."\n");
184+
print(htmlentities($filepath_xml)."\n");
185+
print(join("\n", $ERRORS));
186+
print("\n</pre>");
177187
} else {
178188
make_zip($layout, $keycodes, $cpversion, $platform, $lang);
179189
}

0 commit comments

Comments
 (0)