1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-29 05:21:37 +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
23 changed files with 112 additions and 102 deletions

View File

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

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# build.py — build a sketch using arduino-builder
@ -20,7 +20,6 @@
#
#
from __future__ import print_function
import sys
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
# Replaces esptool-ck.exe and emulates its behavior.
@ -18,6 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from __future__ import print_function
import argparse
import re
import os

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Original espota.py by Ivan Grokhotkov:
# https://gist.github.com/igrr/d35ab8446922179dc58c
@ -8,9 +8,9 @@
# Modified since 2016-01-03 from Matthew O'Gorman (https://githumb.com/mogorman)
#
# 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:
# 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
# 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.
# Tools list is obtained from package/package_esp8266com_index.template.json file.
# 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
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
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
# Adds pyserial to sys.path automatically based on the path of the current file