1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-22 21:23:07 +03:00

Move all scripts and documentation to Python3 (#6378)

* Move all scripts and documentation to Python3

Python 2 EOL is Jan 1, 2020.  Migrate scripts to run under Python 3.

Under Windows, we're already running Python 3.7, by dumb luck.  The
oddness is that the Windows standalone executable for Python 3 is called
"python" whereas under UNIX-like OSes it's called "python3" with
"python" always referring to the Python 2 executable.  The ZIP needs to
be updated to include a Python3.exe (copy of Python.exe) so that we can
use the same command lines under Linux and Windows, and to preserve my
sanity.

Fixes #6376

* Add new Windows ZIP with python3.exe file

* Sort options in boards.txt generation for repeatability

The order of the board opts dict changes depending on the Python version
and machine, so sort the options before printing them to get a stable
ordering.

* Re-add Python2 compatibility tweaks

Most scripts can run as Python 2 or Python 3 with minimal changes, so
re-add (and fix, as necessary) compatibility tweaks to the scripts.
This commit is contained in:
Earle F. Philhower, III 2019-08-28 12:42:48 -07:00 committed by GitHub
parent 1800bb5abe
commit 0a031ce957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 112 additions and 102 deletions

View File

@ -761,15 +761,15 @@ esp8285.menu.baud.3000000.upload.speed=3000000
espduino.name=ESPDuino (ESP-13 Module) espduino.name=ESPDuino (ESP-13 Module)
espduino.build.board=ESP8266_ESP13 espduino.build.board=ESP8266_ESP13
espduino.build.variant=ESPDuino espduino.build.variant=ESPDuino
espduino.menu.ResetMethod.v2=ESPduino-V2
espduino.menu.ResetMethod.v2.upload.resetmethod=nodemcu
espduino.menu.ResetMethod.v1=ESPduino-V1 espduino.menu.ResetMethod.v1=ESPduino-V1
espduino.menu.ResetMethod.v1.upload.resetmethod=ck espduino.menu.ResetMethod.v1.upload.resetmethod=ck
espduino.menu.ResetMethod.v2=ESPduino-V2
espduino.menu.ResetMethod.v2.upload.resetmethod=nodemcu
espduino.menu.UploadTool.espota=OTA
espduino.menu.UploadTool.espota.upload.tool=espota
espduino.menu.UploadTool.esptool=Serial espduino.menu.UploadTool.esptool=Serial
espduino.menu.UploadTool.esptool.upload.tool=esptool espduino.menu.UploadTool.esptool.upload.tool=esptool
espduino.menu.UploadTool.esptool.upload.verbose=--trace espduino.menu.UploadTool.esptool.upload.verbose=--trace
espduino.menu.UploadTool.espota=OTA
espduino.menu.UploadTool.espota.upload.tool=espota
espduino.upload.tool=esptool espduino.upload.tool=esptool
espduino.upload.maximum_data_size=81920 espduino.upload.maximum_data_size=81920
espduino.upload.wait_for_upload_port=true espduino.upload.wait_for_upload_port=true
@ -4592,20 +4592,20 @@ wifinfo.build.board=WIFINFO
wifinfo.build.variant=wifinfo wifinfo.build.variant=wifinfo
wifinfo.menu.ESPModule.ESP07192=ESP07 (1M/192K SPIFFS) wifinfo.menu.ESPModule.ESP07192=ESP07 (1M/192K SPIFFS)
wifinfo.menu.ESPModule.ESP07192.build.board=ESP8266_ESP07 wifinfo.menu.ESPModule.ESP07192.build.board=ESP8266_ESP07
wifinfo.menu.ESPModule.ESP07192.build.flash_size=1M
wifinfo.menu.ESPModule.ESP07192.build.flash_ld=eagle.flash.1m192.ld wifinfo.menu.ESPModule.ESP07192.build.flash_ld=eagle.flash.1m192.ld
wifinfo.menu.ESPModule.ESP07192.build.spiffs_start=0xCB000 wifinfo.menu.ESPModule.ESP07192.build.flash_size=1M
wifinfo.menu.ESPModule.ESP07192.build.spiffs_end=0xFB000
wifinfo.menu.ESPModule.ESP07192.build.spiffs_blocksize=4096 wifinfo.menu.ESPModule.ESP07192.build.spiffs_blocksize=4096
wifinfo.menu.ESPModule.ESP07192.build.spiffs_end=0xFB000
wifinfo.menu.ESPModule.ESP07192.build.spiffs_start=0xCB000
wifinfo.menu.ESPModule.ESP07192.upload.maximum_size=827376 wifinfo.menu.ESPModule.ESP07192.upload.maximum_size=827376
wifinfo.menu.ESPModule.ESP12=ESP12 (4M/1M SPIFFS) wifinfo.menu.ESPModule.ESP12=ESP12 (4M/1M SPIFFS)
wifinfo.menu.ESPModule.ESP12.build.board=ESP8266_ESP12 wifinfo.menu.ESPModule.ESP12.build.board=ESP8266_ESP12
wifinfo.menu.ESPModule.ESP12.build.flash_size=4M
wifinfo.menu.ESPModule.ESP12.build.flash_ld=eagle.flash.4m1m.ld wifinfo.menu.ESPModule.ESP12.build.flash_ld=eagle.flash.4m1m.ld
wifinfo.menu.ESPModule.ESP12.build.spiffs_start=0x300000 wifinfo.menu.ESPModule.ESP12.build.flash_size=4M
wifinfo.menu.ESPModule.ESP12.build.spiffs_end=0x3FB000
wifinfo.menu.ESPModule.ESP12.build.spiffs_blocksize=8192 wifinfo.menu.ESPModule.ESP12.build.spiffs_blocksize=8192
wifinfo.menu.ESPModule.ESP12.build.spiffs_end=0x3FB000
wifinfo.menu.ESPModule.ESP12.build.spiffs_pagesize=256 wifinfo.menu.ESPModule.ESP12.build.spiffs_pagesize=256
wifinfo.menu.ESPModule.ESP12.build.spiffs_start=0x300000
wifinfo.menu.ESPModule.ESP12.upload.maximum_size=1044464 wifinfo.menu.ESPModule.ESP12.upload.maximum_size=1044464
wifinfo.upload.tool=esptool wifinfo.upload.tool=esptool
wifinfo.upload.maximum_data_size=81920 wifinfo.upload.maximum_data_size=81920
@ -4839,16 +4839,16 @@ arduino-esp8266.name=Arduino
arduino-esp8266.build.board=ESP8266_ARDUINO arduino-esp8266.build.board=ESP8266_ARDUINO
arduino-esp8266.menu.BoardModel.primo=Primo arduino-esp8266.menu.BoardModel.primo=Primo
arduino-esp8266.menu.BoardModel.primo.build.board=ESP8266_ARDUINO_PRIMO arduino-esp8266.menu.BoardModel.primo.build.board=ESP8266_ARDUINO_PRIMO
arduino-esp8266.menu.BoardModel.primo.build.variant=arduino_spi
arduino-esp8266.menu.BoardModel.primo.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266 arduino-esp8266.menu.BoardModel.primo.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266
arduino-esp8266.menu.BoardModel.unowifideved=Uno WiFi arduino-esp8266.menu.BoardModel.primo.build.variant=arduino_spi
arduino-esp8266.menu.BoardModel.unowifideved.build.board=ESP8266_ARDUINO_UNOWIFI
arduino-esp8266.menu.BoardModel.unowifideved.build.variant=arduino_uart
arduino-esp8266.menu.BoardModel.unowifideved.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266
arduino-esp8266.menu.BoardModel.starottodeved=Star OTTO arduino-esp8266.menu.BoardModel.starottodeved=Star OTTO
arduino-esp8266.menu.BoardModel.starottodeved.build.variant=arduino_uart
arduino-esp8266.menu.BoardModel.starottodeved.build.board=ESP8266_ARDUINO_STAR_OTTO arduino-esp8266.menu.BoardModel.starottodeved.build.board=ESP8266_ARDUINO_STAR_OTTO
arduino-esp8266.menu.BoardModel.starottodeved.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266 arduino-esp8266.menu.BoardModel.starottodeved.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266
arduino-esp8266.menu.BoardModel.starottodeved.build.variant=arduino_uart
arduino-esp8266.menu.BoardModel.unowifideved=Uno WiFi
arduino-esp8266.menu.BoardModel.unowifideved.build.board=ESP8266_ARDUINO_UNOWIFI
arduino-esp8266.menu.BoardModel.unowifideved.build.extra_flags=-DF_CRYSTAL=40000000 -DESP8266
arduino-esp8266.menu.BoardModel.unowifideved.build.variant=arduino_uart
arduino-esp8266.upload.tool=esptool arduino-esp8266.upload.tool=esptool
arduino-esp8266.upload.maximum_data_size=81920 arduino-esp8266.upload.maximum_data_size=81920
arduino-esp8266.upload.wait_for_upload_port=true arduino-esp8266.upload.wait_for_upload_port=true

View File

@ -14,7 +14,7 @@ ESP8266_BASE = $(ARDUINO_BASE)/hardware/esp8266com/esp8266
ESP8266_TOOLS = $(ESP8266_BASE)/tools ESP8266_TOOLS = $(ESP8266_BASE)/tools
XTENSA_TOOLS_ROOT = $(ESP8266_TOOLS)/xtensa-lx106-elf/bin XTENSA_TOOLS_ROOT = $(ESP8266_TOOLS)/xtensa-lx106-elf/bin
PYTHON_BIN = python PYTHON_BIN = python3
ESPTOOL_PY_BIN = $(ESP8266_TOOLS)/esptool.py ESPTOOL_PY_BIN = $(ESP8266_TOOLS)/esptool.py
ESPOTA_PY_BIN = $(ESP8266_TOOLS)/espota.py ESPOTA_PY_BIN = $(ESP8266_TOOLS)/espota.py
ESPTOOL_BIN = $(ESP8266_TOOLS)/esptool/esptool.exe ESPTOOL_BIN = $(ESP8266_TOOLS)/esptool/esptool.exe

View File

@ -43,7 +43,7 @@ Prerequisites
- Arduino 1.6.8 (or newer, current working version is 1.8.5) - Arduino 1.6.8 (or newer, current working version is 1.8.5)
- git - git
- Python 2.7 (https://python.org) - Python 3.x (https://python.org)
- terminal, console, or command prompt (depending on your OS) - terminal, console, or command prompt (depending on your OS)
- Internet connection - Internet connection
@ -110,7 +110,7 @@ Instructions - Windows 10
.. code:: bash .. code:: bash
cd esp8266/tools cd esp8266/tools
python get.py python3 get.py
- Restart Arduino - Restart Arduino
@ -184,7 +184,7 @@ Instructions - Other OS
.. code:: bash .. code:: bash
cd esp8266/tools cd esp8266/tools
python get.py python3 get.py
- Restart Arduino - Restart Arduino

View File

@ -193,7 +193,7 @@ Instructions below show configuration of OTA on NodeMCU 1.0 (ESP-12E Module) boa
- esp8266/Arduino platform package 2.0.0 or newer - for instructions - esp8266/Arduino platform package 2.0.0 or newer - for instructions
follow follow
https://github.com/esp8266/Arduino#installing-with-boards-manager https://github.com/esp8266/Arduino#installing-with-boards-manager
- Python 2.7 - https://www.python.org/ - Python 3.x - https://www.python.org/
**Note:** Windows users should select “Add python.exe to Path” **Note:** Windows users should select “Add python.exe to Path”
(see below this option is not selected by default). (see below this option is not selected by default).

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# This script pulls the list of Mozilla trusted certificate authorities # This script pulls the list of Mozilla trusted certificate authorities
# from the web at the "mozurl" below, parses the file to grab the PEM # from the web at the "mozurl" below, parses the file to grab the PEM
@ -7,16 +7,18 @@
# and use them for your outgoing SSL connections. # and use them for your outgoing SSL connections.
# #
# Script by Earle F. Philhower, III. Released to the public domain. # Script by Earle F. Philhower, III. Released to the public domain.
from __future__ import print_function
import csv import csv
import os import os
import sys
from subprocess import Popen, PIPE, call from subprocess import Popen, PIPE, call
import urllib2
try: try:
# for Python 2.x from urllib.request import urlopen
except:
from urllib2 import urlopen
try:
from StringIO import StringIO from StringIO import StringIO
except ImportError: except:
# for Python 3.x
from io import StringIO from io import StringIO
# Mozilla's URL for the CSV file with included PEM certs # Mozilla's URL for the CSV file with included PEM certs
@ -25,9 +27,12 @@ mozurl = "https://ccadb-public.secure.force.com/mozilla/IncludedCACertificateRep
# Load the manes[] and pems[] array from the URL # Load the manes[] and pems[] array from the URL
names = [] names = []
pems = [] pems = []
response = urllib2.urlopen(mozurl) response = urlopen(mozurl)
csvData = response.read() csvData = response.read()
csvReader = csv.reader(StringIO(csvData)) if sys.version_info[0] > 2:
csvData = csvData.decode('utf-8')
csvFile = StringIO(csvData)
csvReader = csv.reader(csvFile)
for row in csvReader: for row in csvReader:
names.append(row[0]+":"+row[1]+":"+row[2]) names.append(row[0]+":"+row[1]+":"+row[2])
pems.append(row[30]) pems.append(row[30])
@ -46,10 +51,10 @@ idx = 0
for i in range(0, len(pems)): for i in range(0, len(pems)):
certName = "data/ca_%03d.der" % (idx); certName = "data/ca_%03d.der" % (idx);
thisPem = pems[i].replace("'", "") thisPem = pems[i].replace("'", "")
print names[i] + " -> " + certName print(names[i] + " -> " + certName)
ssl = Popen(['openssl','x509','-inform','PEM','-outform','DER','-out', certName], shell = False, stdin = PIPE) ssl = Popen(['openssl','x509','-inform','PEM','-outform','DER','-out', certName], shell = False, stdin = PIPE)
pipe = ssl.stdin pipe = ssl.stdin
pipe.write(thisPem) pipe.write(thisPem.encode('utf-8'))
pipe.close() pipe.close()
ssl.wait() ssl.wait()
if os.path.exists(certName): if os.path.exists(certName):

View File

@ -74,7 +74,7 @@ fi
# handles tool paths differently when package is installed in hardware folder # handles tool paths differently when package is installed in hardware folder
cat $srcdir/platform.txt | \ cat $srcdir/platform.txt | \
$SED 's/runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-lx106-elf//g' | \ $SED 's/runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-lx106-elf//g' | \
$SED 's/runtime.tools.python.path=.*//g' | \ $SED 's/runtime.tools.python3.path=.*//g' | \
$SED 's/runtime.tools.esptool.path={runtime.platform.path}\/tools\/esptool//g' | \ $SED 's/runtime.tools.esptool.path={runtime.platform.path}\/tools\/esptool//g' | \
$SED 's/tools.esptool.path={runtime.platform.path}\/tools\/esptool/tools.esptool.path=\{runtime.tools.esptool.path\}/g' | \ $SED 's/tools.esptool.path={runtime.platform.path}\/tools\/esptool/tools.esptool.path=\{runtime.tools.esptool.path\}/g' | \
$SED 's/^tools.esptool.cmd=.*//g' | \ $SED 's/^tools.esptool.cmd=.*//g' | \
@ -156,7 +156,7 @@ new_json=package_esp8266com_index.json
set +e set +e
# Merge the old and new, then drop any obsolete package versions # Merge the old and new, then drop any obsolete package versions
python ../../merge_packages.py $new_json $old_json | python ../../drop_versions.py - tools 1.20.0-26-gb404fb9 >tmp && mv tmp $new_json && rm $old_json python3 ../../merge_packages.py $new_json $old_json | python3 ../../drop_versions.py - tools 1.20.0-26-gb404fb9 >tmp && mv tmp $new_json && rm $old_json
# Verify the JSON file can be read, fail if it's not OK # Verify the JSON file can be read, fail if it's not OK
set -e set -e

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# This script drops one or multiple versions of a release # This script drops one or multiple versions of a release
# #
from __future__ import print_function from __future__ import print_function

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# This script merges two Arduino Board Manager package json files. # This script merges two Arduino Board Manager package json files.
# Usage: # Usage:
# python merge_packages.py package_esp8266com_index.json version/new/package_esp8266com_index.json # python merge_packages.py package_esp8266com_index.json version/new/package_esp8266com_index.json

View File

@ -142,52 +142,52 @@
"systems": [ "systems": [
{ {
"host": "x86_64-mingw32", "host": "x86_64-mingw32",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-3/python-3.7.2.post1-embed-win32v2.zip", "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python-3.7.2.post1-embed-win32v2a.zip",
"archiveFileName": "python-3.7.2.post1-embed-win32v2.zip", "archiveFileName": "python-3.7.2.post1-embed-win32v2a.zip",
"checksum": "SHA-256:26665d2925ee75118bb7d8620e9ee988adc2ca3e660a9f4c06a09a06c94c0c29", "checksum": "SHA-256:8eb71cd637c42abbeea9f31912bbaca22222405d8624ace8901c801519321d35",
"size": "6431781" "size": "6481988"
}, },
{ {
"host": "i686-mingw32", "host": "i686-mingw32",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-3/python-3.7.2.post1-embed-win32v2.zip", "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python-3.7.2.post1-embed-win32v2a.zip",
"archiveFileName": "python-3.7.2.post1-embed-win32v2.zip", "archiveFileName": "python-3.7.2.post1-embed-win32va2.zip",
"checksum": "SHA-256:26665d2925ee75118bb7d8620e9ee988adc2ca3e660a9f4c06a09a06c94c0c29", "checksum": "SHA-256:8eb71cd637c42abbeea9f31912bbaca22222405d8624ace8901c801519321d35",
"size": "6431781" "size": "6481988"
}, },
{ {
"host": "aarch64-linux-gnu", "host": "aarch64-linux-gnu",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-3/python-placeholder.tar.gz", "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python3-placeholder.tar.gz",
"archiveFileName": "python-placeholder.tar.gz", "archiveFileName": "python3-placeholder.tar.gz",
"checksum": "SHA-256:3b32fdb0905abf97e923ff968b6a0da8ce85d632b27845d7e2fc759778778785", "checksum": "SHA-256:d8cf9d9d66423d7b90978ebe285a73a6e8611995cd0d5e6273e929a0cf2c9850",
"size": "193" "size": "191"
}, },
{ {
"host": "arm-linux-gnueabihf", "host": "arm-linux-gnueabihf",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-3/python-placeholder.tar.gz", "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python3-placeholder.tar.gz",
"archiveFileName": "python-placeholder.tar.gz", "archiveFileName": "python3-placeholder.tar.gz",
"checksum": "SHA-256:3b32fdb0905abf97e923ff968b6a0da8ce85d632b27845d7e2fc759778778785", "checksum": "SHA-256:d8cf9d9d66423d7b90978ebe285a73a6e8611995cd0d5e6273e929a0cf2c9850",
"size": "193" "size": "191"
}, },
{ {
"host": "i686-pc-linux-gnu", "host": "i686-pc-linux-gnu",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-3/python-placeholder.tar.gz", "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python3-placeholder.tar.gz",
"archiveFileName": "python-placeholder.tar.gz", "archiveFileName": "python3-placeholder.tar.gz",
"checksum": "SHA-256:3b32fdb0905abf97e923ff968b6a0da8ce85d632b27845d7e2fc759778778785", "checksum": "SHA-256:d8cf9d9d66423d7b90978ebe285a73a6e8611995cd0d5e6273e929a0cf2c9850",
"size": "193" "size": "191"
}, },
{ {
"host": "x86_64-apple-darwin", "host": "x86_64-apple-darwin",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-3/python-placeholder.tar.gz", "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python3-placeholder.tar.gz",
"archiveFileName": "python-placeholder.tar.gz", "archiveFileName": "python3-placeholder.tar.gz",
"checksum": "SHA-256:3b32fdb0905abf97e923ff968b6a0da8ce85d632b27845d7e2fc759778778785", "checksum": "SHA-256:d8cf9d9d66423d7b90978ebe285a73a6e8611995cd0d5e6273e929a0cf2c9850",
"size": "193" "size": "191"
}, },
{ {
"host": "x86_64-pc-linux-gnu", "host": "x86_64-pc-linux-gnu",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-3/python-placeholder.tar.gz", "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python3-placeholder.tar.gz",
"archiveFileName": "python-placeholder.tar.gz", "archiveFileName": "python3-placeholder.tar.gz",
"checksum": "SHA-256:3b32fdb0905abf97e923ff968b6a0da8ce85d632b27845d7e2fc759778778785", "checksum": "SHA-256:d8cf9d9d66423d7b90978ebe285a73a6e8611995cd0d5e6273e929a0cf2c9850",
"size": "193" "size": "191"
} }
] ]
}, },

View File

@ -10,7 +10,7 @@ version=2.6.0-dev
# These will be removed by the packager script when doing a JSON release # These will be removed by the packager script when doing a JSON release
runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}/tools/xtensa-lx106-elf runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}/tools/xtensa-lx106-elf
runtime.tools.python.path={runtime.platform.path}/tools/python runtime.tools.python3.path={runtime.platform.path}/tools/python3
runtime.tools.esptool.path={runtime.platform.path}/tools/esptool runtime.tools.esptool.path={runtime.platform.path}/tools/esptool
runtime.tools.signing={runtime.platform.path}/tools/signing.py runtime.tools.signing={runtime.platform.path}/tools/signing.py
@ -84,8 +84,8 @@ compiler.elf2hex.extra_flags=
## generate file with git version number ## generate file with git version number
## needs bash, git, and echo ## needs bash, git, and echo
recipe.hooks.sketch.prebuild.pattern="{runtime.tools.python.path}/python" "{runtime.tools.signing}" --mode header --publickey "{build.source.path}/public.key" --out "{build.path}/core/Updater_Signing.h" recipe.hooks.sketch.prebuild.pattern="{runtime.tools.python3.path}/python3" "{runtime.tools.signing}" --mode header --publickey "{build.source.path}/public.key" --out "{build.path}/core/Updater_Signing.h"
recipe.hooks.core.prebuild.pattern="{runtime.tools.python.path}/python" "{runtime.tools.makecorever}" --build_path "{build.path}" --platform_path "{runtime.platform.path}" --version "unix-{version}" recipe.hooks.core.prebuild.pattern="{runtime.tools.python3.path}/python3" "{runtime.tools.makecorever}" --build_path "{build.path}" --platform_path "{runtime.platform.path}" --version "unix-{version}"
## Build the app.ld linker file ## Build the app.ld linker file
recipe.hooks.linking.prelink.1.pattern="{compiler.path}{compiler.c.cmd}" -CC -E -P {build.vtable_flags} "{runtime.platform.path}/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "{build.path}/local.eagle.app.v6.common.ld" recipe.hooks.linking.prelink.1.pattern="{compiler.path}{compiler.c.cmd}" -CC -E -P {build.vtable_flags} "{runtime.platform.path}/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "{build.path}/local.eagle.app.v6.common.ld"
@ -109,8 +109,8 @@ recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {build.exception_
recipe.objcopy.eep.pattern= recipe.objcopy.eep.pattern=
## Create hex ## Create hex
recipe.objcopy.hex.1.pattern="{runtime.tools.python.path}/python" "{runtime.tools.elf2bin}" --eboot "{runtime.tools.eboot}" --app "{build.path}/{build.project_name}.elf" --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size {build.flash_size} --path "{runtime.tools.xtensa-lx106-elf-gcc.path}/bin" --out "{build.path}/{build.project_name}.bin" recipe.objcopy.hex.1.pattern="{runtime.tools.python3.path}/python3" "{runtime.tools.elf2bin}" --eboot "{runtime.tools.eboot}" --app "{build.path}/{build.project_name}.elf" --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size {build.flash_size} --path "{runtime.tools.xtensa-lx106-elf-gcc.path}/bin" --out "{build.path}/{build.project_name}.bin"
recipe.objcopy.hex.2.pattern="{runtime.tools.python.path}/python" "{runtime.tools.signing}" --mode sign --privatekey "{build.source.path}/private.key" --bin "{build.path}/{build.project_name}.bin" --out "{build.path}/{build.project_name}.bin.signed" --legacy "{build.path}/{build.project_name}.bin.legacy_sig" recipe.objcopy.hex.2.pattern="{runtime.tools.python3.path}/python3" "{runtime.tools.signing}" --mode sign --privatekey "{build.source.path}/private.key" --bin "{build.path}/{build.project_name}.bin" --out "{build.path}/{build.project_name}.bin.signed" --legacy "{build.path}/{build.project_name}.bin.legacy_sig"
## Save hex ## Save hex
recipe.output.tmp_file={build.project_name}.bin recipe.output.tmp_file={build.project_name}.bin
@ -126,12 +126,12 @@ recipe.size.regex.data=^(?:\.data|\.rodata|\.bss)\s+([0-9]+).*
tools.esptool.path= tools.esptool.path=
# Because the variable expansion doesn't allow one tool to find another, the following lines # Because the variable expansion doesn't allow one tool to find another, the following lines
# will point to "{runtime.platform.path}/tools/python/python" in GIT and # will point to "{runtime.platform.path}/tools/python3/python3" in GIT and
# "{runtime.tools.python.path}/python" for JSON board manager releases. # "{runtime.tools.python3.path}/python3" for JSON board manager releases.
#tools.esptool.cmd={runtime.tools.python.path}/python #tools.esptool.cmd={runtime.tools.python3.path}/python3
#tools.esptool.network_cmd={runtime.tools.python.path}/python #tools.esptool.network_cmd={runtime.tools.python3.path}/python3
tools.esptool.cmd={runtime.platform.path}/tools/python/python tools.esptool.cmd={runtime.platform.path}/tools/python3/python3
tools.esptool.network_cmd={runtime.platform.path}/tools/python/python tools.esptool.network_cmd={runtime.platform.path}/tools/python3/python3
tools.esptool.upload.protocol=esp tools.esptool.upload.protocol=esp
tools.esptool.upload.params.verbose=--trace tools.esptool.upload.params.verbose=--trace

View File

@ -65,7 +65,7 @@ function build_sketches()
local build_rem=$5 local build_rem=$5
local lwip=$6 local lwip=$6
mkdir -p $build_dir mkdir -p $build_dir
local build_cmd="python tools/build.py -b generic -v -w all -s 4M1M -v -k --build_cache $cache_dir -p $PWD/$build_dir -n $lwip $build_arg " local build_cmd="python3 tools/build.py -b generic -v -w all -s 4M1M -v -k --build_cache $cache_dir -p $PWD/$build_dir -n $lwip $build_arg "
local sketches=$(find $srcpath -name *.ino | sort) local sketches=$(find $srcpath -name *.ino | sort)
print_size_info >size.log print_size_info >size.log
export ARDUINO_IDE_PATH=$arduino export ARDUINO_IDE_PATH=$arduino
@ -163,7 +163,7 @@ function install_ide()
cat esp8266/platform.local.txt cat esp8266/platform.local.txt
echo -e "\n----\n" echo -e "\n----\n"
cd esp8266/tools cd esp8266/tools
python get.py python3 get.py
export PATH="$ide_path:$core_path/tools/xtensa-lx106-elf/bin:$PATH" export PATH="$ide_path:$core_path/tools/xtensa-lx106-elf/bin:$PATH"
} }

View File

@ -4,8 +4,7 @@ TEST_LIST ?= $(wildcard test_*/*.ino)
ESP8266_CORE_PATH ?= $(realpath ../..) ESP8266_CORE_PATH ?= $(realpath ../..)
BUILD_DIR ?= $(PWD)/.build BUILD_DIR ?= $(PWD)/.build
HARDWARE_DIR ?= $(PWD)/.hardware HARDWARE_DIR ?= $(PWD)/.hardware
#PYTHON ?= python3 PYTHON ?= python3
PYTHON ?= python
ESPTOOL ?= $(PYTHON) $(ESP8266_CORE_PATH)/tools/esptool/esptool.py ESPTOOL ?= $(PYTHON) $(ESP8266_CORE_PATH)/tools/esptool/esptool.py
MKSPIFFS ?= $(ESP8266_CORE_PATH)/tools/mkspiffs/mkspiffs MKSPIFFS ?= $(ESP8266_CORE_PATH)/tools/mkspiffs/mkspiffs
UPLOAD_PORT ?= $(shell ls /dev/tty* | grep -m 1 -i USB) UPLOAD_PORT ?= $(shell ls /dev/tty* | grep -m 1 -i USB)

View File

@ -15,7 +15,7 @@ $(PYTHON_ENV_DIR):
. $(PYTHON_ENV_DIR)/bin/activate && pip install -r requirements.txt . $(PYTHON_ENV_DIR)/bin/activate && pip install -r requirements.txt
test: $(TEST_EXECUTABLE) $(PYTHON_ENV_DIR) test: $(TEST_EXECUTABLE) $(PYTHON_ENV_DIR)
. $(PYTHON_ENV_DIR)/bin/activate && python runner.py -e $(TEST_EXECUTABLE) -m test/test.py . $(PYTHON_ENV_DIR)/bin/activate && $(PYTHON) runner.py -e $(TEST_EXECUTABLE) -m test/test.py
$(TEST_EXECUTABLE): test/test.cpp $(TEST_EXECUTABLE): test/test.cpp
g++ -std=c++11 -Isrc -o $@ test/test.cpp g++ -std=c++11 -Isrc -o $@ test/test.cpp

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
from __future__ import print_function from __future__ import print_function
import pexpect import pexpect
from pexpect import EOF, TIMEOUT, fdpexpect from pexpect import EOF, TIMEOUT, fdpexpect

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# This script pulls the list of Mozilla trusted certificate authorities # This script pulls the list of Mozilla trusted certificate authorities
# from the web at the "mozurl" below, parses the file to grab the PEM # from the web at the "mozurl" below, parses the file to grab the PEM
@ -7,16 +7,18 @@
# and use them for your outgoing SSL connections. # and use them for your outgoing SSL connections.
# #
# Script by Earle F. Philhower, III. Released to the public domain. # Script by Earle F. Philhower, III. Released to the public domain.
from __future__ import print_function
import csv import csv
import os import os
import sys
from subprocess import Popen, PIPE, call from subprocess import Popen, PIPE, call
import urllib2
try: try:
# for Python 2.x from urllib.request import urlopen
except:
from urllib2 import urlopen
try:
from StringIO import StringIO from StringIO import StringIO
except ImportError: except:
# for Python 3.x
from io import StringIO from io import StringIO
# Mozilla's URL for the CSV file with included PEM certs # Mozilla's URL for the CSV file with included PEM certs
@ -25,9 +27,12 @@ mozurl = "https://ccadb-public.secure.force.com/mozilla/IncludedCACertificateRep
# Load the manes[] and pems[] array from the URL # Load the manes[] and pems[] array from the URL
names = [] names = []
pems = [] pems = []
response = urllib2.urlopen(mozurl) response = urlopen(mozurl)
csvData = response.read() csvData = response.read()
csvReader = csv.reader(StringIO(csvData)) if sys.version_info[0] > 2:
csvData = csvData.decode('utf-8')
csvFile = StringIO(csvData)
csvReader = csv.reader(csvFile)
for row in csvReader: for row in csvReader:
names.append(row[0]+":"+row[1]+":"+row[2]) names.append(row[0]+":"+row[1]+":"+row[2])
pems.append(row[30]) pems.append(row[30])
@ -46,10 +51,10 @@ idx = 0
for i in range(0, len(pems)): for i in range(0, len(pems)):
certName = "data/ca_%03d.der" % (idx); certName = "data/ca_%03d.der" % (idx);
thisPem = pems[i].replace("'", "") thisPem = pems[i].replace("'", "")
print names[i] + " -> " + certName print(names[i] + " -> " + certName)
ssl = Popen(['openssl','x509','-inform','PEM','-outform','DER','-out', certName], shell = False, stdin = PIPE) ssl = Popen(['openssl','x509','-inform','PEM','-outform','DER','-out', certName], shell = False, stdin = PIPE)
pipe = ssl.stdin pipe = ssl.stdin
pipe.write(thisPem) pipe.write(thisPem.encode('utf-8'))
pipe.close() pipe.close()
ssl.wait() ssl.wait()
if os.path.exists(certName): if os.path.exists(certName):

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# boards.txt python builder for esp8266/Arduino # boards.txt python builder for esp8266/Arduino
# Copyright (C) 2017 community # Copyright (C) 2017 community
@ -32,6 +32,7 @@
# 512K/1M/2M/4M/8M/16M: menus for flash & SPIFFS size # 512K/1M/2M/4M/8M/16M: menus for flash & SPIFFS size
# lwip/lwip2 menus for available lwip versions # lwip/lwip2 menus for available lwip versions
from __future__ import print_function
import os import os
import sys import sys
import collections import collections
@ -1410,7 +1411,7 @@ def all_boards ():
# standalone options # standalone options
if 'opts' in board: if 'opts' in board:
for optname in board['opts']: for optname in sorted(board['opts']):
print(id + optname + '=' + board['opts'][optname]) print(id + optname + '=' + board['opts'][optname])
# macros # macros

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# build.py — build a sketch using arduino-builder # build.py — build a sketch using arduino-builder
@ -20,7 +20,6 @@
# #
# #
from __future__ import print_function from __future__ import print_function
import sys import sys
import os import os

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# Generate an Arduino compatible BIN file from bootloader and sketch ELF # Generate an Arduino compatible BIN file from bootloader and sketch ELF
# Replaces esptool-ck.exe and emulates its behavior. # Replaces esptool-ck.exe and emulates its behavior.
@ -18,6 +18,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
from __future__ import print_function
import argparse import argparse
import re import re
import os import os

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# #
# Original espota.py by Ivan Grokhotkov: # Original espota.py by Ivan Grokhotkov:
# https://gist.github.com/igrr/d35ab8446922179dc58c # https://gist.github.com/igrr/d35ab8446922179dc58c
@ -8,9 +8,9 @@
# Modified since 2016-01-03 from Matthew O'Gorman (https://githumb.com/mogorman) # Modified since 2016-01-03 from Matthew O'Gorman (https://githumb.com/mogorman)
# #
# This script will push an OTA update to the ESP # This script will push an OTA update to the ESP
# use it like: python espota.py -i <ESP_IP_address> -I <Host_IP_address> -p <ESP_port> -P <Host_port> [-a password] -f <sketch.bin> # use it like: python3 espota.py -i <ESP_IP_address> -I <Host_IP_address> -p <ESP_port> -P <Host_port> [-a password] -f <sketch.bin>
# Or to upload SPIFFS image: # Or to upload SPIFFS image:
# python espota.py -i <ESP_IP_address> -I <Host_IP_address> -p <ESP_port> -P <HOST_port> [-a password] -s -f <spiffs.bin> # python3 espota.py -i <ESP_IP_address> -I <Host_IP_address> -p <ESP_port> -P <HOST_port> [-a password] -s -f <spiffs.bin>
# #
# Changes # Changes
# 2015-09-18: # 2015-09-18:

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# This script will download and extract required tools into the current directory. # This script will download and extract required tools into the current directory.
# Tools list is obtained from package/package_esp8266com_index.template.json file. # Tools list is obtained from package/package_esp8266com_index.template.json file.
# Written by Ivan Grokhotkov, 2015. # Written by Ivan Grokhotkov, 2015.

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# Generate the core_version.h header per-build # Generate the core_version.h header per-build
# #

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
import argparse import argparse

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# Wrapper for Arduino core / others that can call esptool.py possibly multiple times # Wrapper for Arduino core / others that can call esptool.py possibly multiple times
# Adds pyserial to sys.path automatically based on the path of the current file # Adds pyserial to sys.path automatically based on the path of the current file