Skip to content

Commit 7a13333

Browse files
committed
Update min python version from 3.6 to 3.8
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 Replaces: #23378 Fixes: #23387
1 parent 43c6f03 commit 7a13333

File tree

4 files changed

+7
-25
lines changed

4 files changed

+7
-25
lines changed

Diff for: ChangeLog.md

+2
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
----------------

Diff for: tools/building.py

+1-12
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)

Diff for: tools/shared.py

+3-3
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

Diff for: tools/system_libs.py

+1-10
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)