Skip to content

Commit e3dce64

Browse files
authored
Update min python version from 3.6 to 3.8 (#23417)
The reason for picking 3.8 here is that it provides all the features we currently have need of, and it available in the places we care about: - debian/stable (bookworm): 3.11 - ubuntu/LTS (focal): 3.8 - emsdk: 3.9.2 The motivation for this change is twofold: 1. We get access to a few more python features. 2. We actually test using the version we claim to support (3.8 on ubuntu/focal in CI). Currently the claim that we support 3.6 could well be a lie. We don't do any testing on 3.6 do who knows if incompatibilities have snuck in. Replaces: #23378 Fixes: #23387
1 parent 43c6f03 commit e3dce64

File tree

4 files changed

+7
-25
lines changed

4 files changed

+7
-25
lines changed

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ See docs/process.md for more on how version tagging works.
2323
- emscan-deps tools was added. This tool wraps clang-scan-deps and injects the
2424
needed `--target` and `--sysroot` argument that would normally be injected by
2525
emcc itself. This enables support for C++20 in cmake projects. (#21987)
26+
- The version of python required to run emscripten was bumped from 3.6 to 3.8.
27+
(#23417)
2628

2729
4.0.2 - 01/30/25
2830
----------------

tools/building.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -483,17 +483,6 @@ def check_closure_compiler(cmd, args, env, allowed_to_fail):
483483
return True
484484

485485

486-
# Remove this once we require python3.7 and can use std.isascii.
487-
# See: https://docs.python.org/3/library/stdtypes.html#str.isascii
488-
def isascii(s):
489-
try:
490-
s.encode('ascii')
491-
except UnicodeEncodeError:
492-
return False
493-
else:
494-
return True
495-
496-
497486
def get_closure_compiler_and_env(user_args):
498487
env = shared.env_with_node_in_path()
499488
closure_cmd = get_closure_compiler()
@@ -630,7 +619,7 @@ def run_closure_cmd(cmd, filename, env):
630619
tempfiles = shared.get_temp_files()
631620

632621
def move_to_safe_7bit_ascii_filename(filename):
633-
if isascii(filename):
622+
if filename.isascii():
634623
return os.path.abspath(filename)
635624
safe_filename = tempfiles.get('.js').name # Safe 7-bit filename
636625
shutil.copyfile(filename, safe_filename)

tools/shared.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
import sys
2020
import tempfile
2121

22-
# We depend on python 3.6 for fstring support
23-
if sys.version_info < (3, 6):
24-
print('error: emscripten requires python 3.6 or above', file=sys.stderr)
22+
# We depend on python 3.8 features
23+
if sys.version_info < (3, 8):
24+
print(f'error: emscripten requires python 3.8 or above ({sys.executable} {sys.version})', file=sys.stderr)
2525
sys.exit(1)
2626

2727
from . import colored_logger

tools/system_libs.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,17 +2457,8 @@ def calculate(options):
24572457
return ret
24582458

24592459

2460-
# Once we require python 3.8 we can use shutil.copytree with
2461-
# dirs_exist_ok=True and remove this function.
24622460
def copytree_exist_ok(src, dst):
2463-
os.makedirs(dst, exist_ok=True)
2464-
for entry in os.scandir(src):
2465-
srcname = os.path.join(src, entry.name)
2466-
dstname = os.path.join(dst, entry.name)
2467-
if entry.is_dir():
2468-
copytree_exist_ok(srcname, dstname)
2469-
else:
2470-
shared.safe_copy(srcname, dstname)
2461+
shutil.copytree(src, dst, dirs_exist_ok=True)
24712462

24722463

24732464
def install_system_headers(stamp):

0 commit comments

Comments
 (0)