From bb6243a17b5a2e1f0c99616c354e8f5f7a9ca86b Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Tue, 14 Jan 2020 06:53:17 -0800 Subject: [PATCH] Use a python3 script to call python3 (#6960) * Use a python3 script to call python3 It's odd, but because Windows requires a full Python3 install we must have an executable called "tools/python3/python3" to use Python3 in the toolchain. Before, we simply symlinked to /usr/bin/python3 (for Linux) or /usr/local/bin/python3 (Mac). Unfortunately, depending on the method of installation, on MacOS the Python3 executable can be in /usr/bin/python3 instead. To avoid the entire issue, unify the Mac and Linux python3 placeholders to use python3 itself to jump to the real executable. Fixes #6931 * Explicitly remove old symlink to python3 The tar extraction for the updated python3 tarball will fail on systems that already have a symlink in /tools/python3/python3 because the tar extractor attempts to open the *target of the symlink* (i.e. the actual interpreter in /usr/bin or /usr/local/bin). Add a commented hack to destroy this symlink before expanding the tarballs, if the file exists. This is safe to do since it will be overwritten by any extractions of the python3 tarball later in the process. Co-authored-by: david gauchard --- .../package_esp8266com_index.template.json | 40 +++++++++---------- tools/get.py | 3 ++ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/package/package_esp8266com_index.template.json b/package/package_esp8266com_index.template.json index 7fc538420..4cb8a1a27 100644 --- a/package/package_esp8266com_index.template.json +++ b/package/package_esp8266com_index.template.json @@ -156,38 +156,38 @@ }, { "host": "aarch64-linux-gnu", - "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python3-placeholder.tar.gz", - "archiveFileName": "python3-placeholder.tar.gz", - "checksum": "SHA-256:d8cf9d9d66423d7b90978ebe285a73a6e8611995cd0d5e6273e929a0cf2c9850", - "size": "191" + "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python3-via-env.tar.gz", + "archiveFileName": "python3-via-env.tar.gz", + "checksum": "SHA-256:c9237bfe0f62842d7187a39495baa4a7e3ab8b87c0b433614294b023cf0bc0f3", + "size": "292" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python3-placeholder.tar.gz", - "archiveFileName": "python3-placeholder.tar.gz", - "checksum": "SHA-256:d8cf9d9d66423d7b90978ebe285a73a6e8611995cd0d5e6273e929a0cf2c9850", - "size": "191" + "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python3-via-env.tar.gz", + "archiveFileName": "python3-via-env.tar.gz", + "checksum": "SHA-256:c9237bfe0f62842d7187a39495baa4a7e3ab8b87c0b433614294b023cf0bc0f3", + "size": "292" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python3-placeholder.tar.gz", - "archiveFileName": "python3-placeholder.tar.gz", - "checksum": "SHA-256:d8cf9d9d66423d7b90978ebe285a73a6e8611995cd0d5e6273e929a0cf2c9850", - "size": "191" + "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python3-via-env.tar.gz", + "archiveFileName": "python3-via-env.tar.gz", + "checksum": "SHA-256:c9237bfe0f62842d7187a39495baa4a7e3ab8b87c0b433614294b023cf0bc0f3", + "size": "292" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python3-macosx-placeholder.tar.gz", - "archiveFileName": "python3-macosx-placeholder.tar.gz", - "checksum": "SHA-256:5bfa0d4c2dc3edeeaa913f4eac42ef3ff0bf8c8fe9f11be112a8ca7911de2dae", - "size": "198" + "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python3-via-env.tar.gz", + "archiveFileName": "python3-via-env.tar.gz", + "checksum": "SHA-256:c9237bfe0f62842d7187a39495baa4a7e3ab8b87c0b433614294b023cf0bc0f3", + "size": "292" }, { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python3-placeholder.tar.gz", - "archiveFileName": "python3-placeholder.tar.gz", - "checksum": "SHA-256:d8cf9d9d66423d7b90978ebe285a73a6e8611995cd0d5e6273e929a0cf2c9850", - "size": "191" + "url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-4/python3-via-env.tar.gz", + "archiveFileName": "python3-via-env.tar.gz", + "checksum": "SHA-256:c9237bfe0f62842d7187a39495baa4a7e3ab8b87c0b433614294b023cf0bc0f3", + "size": "292" } ] }, diff --git a/tools/get.py b/tools/get.py index 74b6b510d..af39a10f3 100755 --- a/tools/get.py +++ b/tools/get.py @@ -121,6 +121,9 @@ def main(): if len(sys.argv) == 2: if sys.argv[1] == "-q": verbose = False + # Remove a symlink generated in 2.6.3 which causes later issues since the tarball can't properly overwrite it + if (os.path.exists('python3/python3')): + os.unlink('python3/python3') print('Platform: {0}'.format(identify_platform())) tools_to_download = load_tools_list('../package/package_esp8266com_index.template.json', identify_platform()) mkdir_p(dist_dir)