Skip to content

Commit 4bf4524

Browse files
committed
build for CP8 and bump mpy-cross for CP7
1 parent 135a08b commit 4bf4524

7 files changed

+38
-23
lines changed

build.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,12 @@ def date_to_version(tag):
7575
SET_VERSION_PATTERN = "\n__version__ = '{}'\n"
7676
THIS_REPOSITORY = "https://github.com/Neradoc/Circuitpython_Keyboard_Layouts.git"
7777

78-
PLATFORMS = ["mpy6", "mpy7"]
78+
PLATFORMS = ["mpy6", "mpy7", "mpy8"]
7979
PLATFORM_NAMES = {
8080
"py": "py",
8181
"mpy6": "6.x-mpy",
8282
"mpy7": "7.x-mpy",
83+
"mpy8": "8.x-mpy",
8384
}
8485

8586
# https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/mpy-cross/
@@ -88,19 +89,23 @@ def date_to_version(tag):
8889
MPYCROSSES = {
8990
"darwin": {
9091
"mpy6": "mpy-cross-macos-catalina-6.3.0",
91-
"mpy7": "mpy-cross-macos-universal-7.0.0",
92+
"mpy7": "mpy-cross-macos-universal-7.3.0",
93+
"mpy8": "mpy-cross-macos-universal-8.0.0-alpha.1",
9294
},
9395
"linux": {
9496
"mpy6": "mpy-cross.static-amd64-linux-6.3.0",
95-
"mpy7": "mpy-cross.static-amd64-linux-7.0.0",
97+
"mpy7": "mpy-cross.static-amd64-linux-7.3.0",
98+
"mpy8": "mpy-cross.static-amd64-linux-8.0.0-alpha.1",
9699
},
97100
"win32": {
98101
"mpy6": "mpy-cross.static-x64-windows-6.3.0.exe",
99-
"mpy7": "mpy-cross.static-x64-windows-7.0.0.exe",
102+
"mpy7": "mpy-cross.static-x64-windows-7.3.0.exe",
103+
"mpy8": "mpy-cross.static-x64-windows-8.0.0-alpha.1.exe",
100104
},
101105
"raspbian": {
102106
"mpy6": "mpy-cross.static-raspbian-6.3.0",
103-
"mpy7": "mpy-cross.static-raspbian-7.0.0",
107+
"mpy7": "mpy-cross.static-raspbian-7.3.0",
108+
"mpy8": "mpy-cross.static-raspbian-8.0.0-alpha.1",
104109
},
105110
}
106111
MPYCROSS = MPYCROSSES[sys.platform]
@@ -282,7 +287,7 @@ def make_the_mpy_bundles():
282287
fstats = os.stat(cross_file)
283288
os.chmod(cross_file, fstats.st_mode | stat.S_IEXEC)
284289

285-
# duplicate the py dir to mpy6 and mpy7
290+
# duplicate the py dir to mpy dirs
286291
pwd = os.getcwd()
287292
for platform in PLATFORMS:
288293
cross = os.path.join(BUILD_DEPS, MPYCROSS[platform])

generator-web/layout_generator.html

+12-11
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,15 @@
5151
.download_link#download_link
5252
{
5353
display: none;
54-
width: calc(800px - 6 * 8px - 80px - 3px);
54+
/* with - padding - spacing */
55+
width: calc(800px - 16px - 3 * (40px + 16px + 1px) - 1px);
5556
}
56-
.download_link#download_link6
57+
.download_link#download_link6,
58+
.download_link#download_link7,
59+
.download_link#download_link8
5760
{
5861
display: none;
59-
width: calc(40px);
60-
}
61-
.download_link#download_link7
62-
{
63-
display: none;
64-
width: calc(40px);
62+
width: 40px;
6563
}
6664
#debug_area { display: none; }
6765
#sample_code {
@@ -80,16 +78,18 @@
8078
<div id="content">
8179
<!-- <p class="warning">This will not work with browsers that block access to external sites from javascript.<br/>Oh well, I'll try something else...</p> -->
8280
<p>Generate a Windows keyboard layout for Circuitpython's <a href="https://circuitpython.readthedocs.io/projects/hid/en/latest/">adafruit_hid</a>.</p>
81+
<p>This is the online generator for the <a href="https://github.com/Neradoc/Circuitpython_Keyboard_Layouts">Circuitpython Keyboard Layouts</a> repository.</p>
8382
<ul>
8483
<li>Go to <a target="_BLANK" href="https://kbdlayout.info/">kbdlayout.info</a> and find your layout's page.</li>
8584
<li>Paste the url of the layout into the box below (see example).</li>
8685
<li>Press the "Make Zip Bundle Links" button.</li>
8786
<li>Click the link to download the zip with the modules.</li>
8887
<li>Unzip the zip.</li>
89-
<li>Copy the files to your boards "lib" directory (the sample code is not needed).</li>
90-
<li>Don't forget to install adafruit_hid too if it's not already there.</li>
88+
<li>Copy the files to your boards "lib" directory (not the sample code).</li>
89+
<li>Don't forget ton install adafruit_hid too if it's not already there.</li>
9190
<li>Follow the sample code, included in the zip.</li>
92-
<li>Come bother me <a href="https://adafru.it/discord">on discord</a> if it doesn't work (no private messages).</li>
91+
<li>Come bother me <a href="https://adafru.it/discord">on the adafruit discord</a> if it doesn't work (no private messages).</li>
92+
<li>Or <a href="https://github.com/Neradoc/Circuitpython_Keyboard_Layouts/issues">open an issue on github</a>.</li>
9393
</ul>
9494
<p class="note">Note: There are additional links to have the module files pre-compiled for Circuitpython 6 or 7. A pre-compiled (.mpy) file takes less space and is faster to load. It also requires less RAM to load, which <i>might</i> allow it to be used on a SAMD21 board (often refered to M0, they are very limited in memory when running Circuitpython).</p>
9595
<p>
@@ -100,6 +100,7 @@
100100
<a class="download_link" id="download_link" href="">Download the zip file (.py)</a>
101101
<a class="download_link" id="download_link6" href="">CP6</a>
102102
<a class="download_link" id="download_link7" href="">CP7</a>
103+
<a class="download_link" id="download_link8" href="">CP8</a>
103104
<p>
104105
<div id="debug_area">
105106
<pre id="debug">DEBUG</pre>

generator-web/layout_generator.js

+2
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ function download_layout() {
449449
{ extension: ".py", extout: ".py", id: "", version: "py" },
450450
{ extension: "6.mpy", extout: ".mpy", id: "6", version: "mpy6" },
451451
{ extension: "7.mpy", extout: ".mpy", id: "7", version: "mpy7" },
452+
{ extension: "8.mpy", extout: ".mpy", id: "8", version: "mpy8" },
452453
];
453454
for( z in zips ) {
454455
(() => {
@@ -463,6 +464,7 @@ function download_layout() {
463464
var base_layout_local = BASE_LAYOUT_NAME.replace("{}", zipper.extension);
464465
var base_layout_file = BASE_DIR + base_layout_local;
465466
$.get(base_layout_file, (data) => {
467+
console.log(base_layout_name);
466468
outputZip.file(base_layout_name, data);
467469
outputZip.generateAsync({type:"base64"}).then(function (base64) {
468470
zip_data = "data:application/zip;base64," + base64;

generator-web/layout_generator_link.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function download_layout() {
1212
{ extension: ".py", extout: ".py", id: "", version: "py" },
1313
{ extension: "6.mpy", extout: ".mpy", id: "6", version: "mpy6" },
1414
{ extension: "7.mpy", extout: ".mpy", id: "7", version: "mpy7" },
15+
{ extension: "8.mpy", extout: ".mpy", id: "8", version: "mpy8" },
1516
];
1617
for( z in zips ) {
1718
var zipper = zips[z];
@@ -22,7 +23,7 @@ function download_layout() {
2223

2324
//
2425
$("#download_link"+zipper.id).attr("href", zurl);
25-
// $("#download_link"+zipper.id).attr("download", zip_file);
26+
//$("#download_link"+zipper.id).attr("download", zip_file);
2627
$("#download_link"+zipper.id).attr("title", zip_file);
2728
$("#download_link"+zipper.id).show();
2829
}

generator-web/make_zip_bundle.php

+11-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
ob_start();
77
$ERRORS = [];
8-
$LAYOUT_BASE = false;
8+
define("LAYOUT_BASE", false);
99

1010
$source_url = "";
1111
$platform = "win";
@@ -91,7 +91,7 @@
9191

9292
$keycodes = preg_replace("/".preg_quote($VERSION0)."/", $VERSION, $keycodes);
9393

94-
if($LAYOUT_BASE) {
94+
if(LAYOUT_BASE) {
9595
if( !file_exists("src/keyboard_layout6.mpy") ) {
9696
exec("mpy-cross/mpy-cross.static-amd64-linux-6 src/keyboard_layout.py");
9797
rename("src/keyboard_layout.mpy", "src/keyboard_layout6.mpy");
@@ -100,6 +100,10 @@
100100
exec("mpy-cross/mpy-cross.static-amd64-linux-7 src/keyboard_layout.py");
101101
rename("src/keyboard_layout.mpy", "src/keyboard_layout7.mpy");
102102
}
103+
if( !file_exists("src/keyboard_layout8.mpy") ) {
104+
exec("mpy-cross/mpy-cross.static-amd64-linux-8 src/keyboard_layout.py");
105+
rename("src/keyboard_layout.mpy", "src/keyboard_layout8.mpy");
106+
}
103107
}
104108

105109
function make_zip($layout, $keycodes, $cpversion, $platform, $lang) {
@@ -110,6 +114,8 @@ function make_zip($layout, $keycodes, $cpversion, $platform, $lang) {
110114
$filepath_zip = "data/layout_files_".$platform."_".$lang."-6mpy.zip";
111115
} elseif( $cpversion == "7" ) {
112116
$filepath_zip = "data/layout_files_".$platform."_".$lang."-7mpy.zip";
117+
} elseif( $cpversion == "8" ) {
118+
$filepath_zip = "data/layout_files_".$platform."_".$lang."-8mpy.zip";
113119
} else {
114120
$filepath_zip = "data/layout_files_".$platform."_".$lang."-py.zip";
115121
}
@@ -125,7 +131,7 @@ function make_zip($layout, $keycodes, $cpversion, $platform, $lang) {
125131
$layout_file = "keyboard_layout_" . $platform . "_" . $lang . ".py";
126132
$keycodes_file = "keycode_" . $platform . "_" . $lang . ".py";
127133

128-
if( $cpversion == "6" || $cpversion == "7" ) {
134+
if( $cpversion == "6" || $cpversion == "7" || $cpversion == "8" ) {
129135
# layout
130136
$layout_name = preg_replace("/\.py$/", ".mpy", $layout_file);
131137
$tempfile = "data/" . uniqid() . "_" . $layout_file;
@@ -145,13 +151,13 @@ function make_zip($layout, $keycodes, $cpversion, $platform, $lang) {
145151
$deletes[] = $tempfile;
146152
$deletes[] = $mpyfile;
147153
# layout base
148-
if($LAYOUT_BASE) {
154+
if(LAYOUT_BASE) {
149155
$zip->addFile("src/keyboard_layout".$cpversion.".mpy", "keyboard_layout.mpy");
150156
}
151157
} else {
152158
$zip->addFromString($layout_file, $layout);
153159
$zip->addFromString($keycodes_file, $keycodes);
154-
if($LAYOUT_BASE) {
160+
if(LAYOUT_BASE) {
155161
$zip->addFile("src/keyboard_layout.py", "keyboard_layout.py");
156162
}
157163
}
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)