Skip to content

Commit 5532b5d

Browse files
committed
Default to running python3 for x.py
On my macOS machine, there is no python binary on the PATH. In this day and age (15 months after Python 2 has gone EOL), it doesn't seem crazy to default to Python3. Users who don't have python3 available could supposedly still run `python x.py` manually. This assumes that any environment where `python` is at version 3, `python3` is also on the PATH.
1 parent e730969 commit 5532b5d

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

x.py

+1-16
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,10 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# This file is only a "symlink" to bootstrap.py, all logic should go there.
44

55
import os
66
import sys
77

8-
# If this is python2, check if python3 is available and re-execute with that
9-
# interpreter.
10-
if sys.version_info.major < 3:
11-
try:
12-
# On Windows, `py -3` sometimes works.
13-
# Try this first, because 'python3' sometimes tries to launch the app
14-
# store on Windows
15-
os.execvp("py", ["py", "-3"] + sys.argv)
16-
except OSError:
17-
try:
18-
os.execvp("python3", ["python3"] + sys.argv)
19-
except OSError:
20-
# Python 3 isn't available, fall back to python 2
21-
pass
22-
238
rust_dir = os.path.dirname(os.path.abspath(__file__))
249
sys.path.append(os.path.join(rust_dir, "src", "bootstrap"))
2510

0 commit comments

Comments
 (0)