Skip to content

Commit cd8f5d8

Browse files
authored
Drop python 2 support in emsdk.py (#1608)
Fixes: #1592
1 parent 69e3df9 commit cd8f5d8

2 files changed

Lines changed: 9 additions & 23 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,7 @@ jobs:
8383
name: install python deps
8484
command: |
8585
apt-get update -q
86-
apt-get install -q -y python2 python3-pip
87-
- run:
88-
name: python2 flake8
89-
command: |
90-
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
91-
python2 get-pip.py
92-
python2 -m pip install flake8==3.9.2
93-
python2 -m flake8 --show-source --statistics --extend-exclude=./scripts
86+
apt-get install -q -y python3-pip
9487
- run:
9588
name: python3 flake8
9689
command: |

emsdk.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# Copyright 2019 The Emscripten Authors. All rights reserved.
33
# Emscripten is available under two separate licenses, the MIT license and the
44
# University of Illinois/NCSA Open Source License. Both these licenses can be
55
# found in the LICENSE file.
66

7-
from __future__ import print_function
8-
97
import copy
108
from collections import OrderedDict
119
import errno
@@ -23,21 +21,16 @@
2321
import tarfile
2422
import zipfile
2523
if os.name == 'nt':
26-
try:
27-
import winreg
28-
except ImportError:
29-
# old python 2 name
30-
import _winreg as winreg
24+
import winreg
3125
import ctypes.wintypes
3226

33-
if sys.version_info >= (3,):
34-
from urllib.parse import urljoin
35-
from urllib.request import urlopen
36-
import functools
37-
else:
38-
from urlparse import urljoin
39-
from urllib2 import urlopen
27+
from urllib.parse import urljoin
28+
from urllib.request import urlopen
29+
import functools
4030

31+
if sys.version_info < (3, 0):
32+
print(f'error: emsdk requires python 3.0 or above ({sys.executable} {sys.version})', file=sys.stderr)
33+
sys.exit(1)
4134

4235
emsdk_packages_url = 'https://storage.googleapis.com/webassembly/emscripten-releases-builds/deps/'
4336

0 commit comments

Comments
 (0)