Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cc7c807

Browse files
committedAug 7, 2019
Remove PYTHON key from .emscripten config file.
While reviewing #9166 I noticed that support a PYTHON key in the config file but this doesn't effect any of the entry point (on UNIX the entry points are defined by the #! line, on windows they are are defined as `python` in the bat files. So really this was only effecting python sub-processes not the compiler itself. This feature doesn't seem like its useful, and also has no tests, so removing it for now. However for the benefit of #9166 add support for setting this via the `EM_PYTHON` environment variable.
1 parent 5f3be1a commit cc7c807

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed
 

‎tools/settings_template_readonly.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# Note: If you put paths relative to the home directory, do not forget
55
# os.path.expanduser
66

7-
# Note: On Windows, remember to escape backslashes! I.e. PYTHON='c:\Python27\'
8-
# is not valid, but PYTHON='c:\\Python27\\' and PYTHON='c:/Python27/'
7+
# Note: On Windows, remember to escape backslashes! I.e. LLVM='c:\llvm\'
8+
# is not valid, but LLVM='c:\\llvm\\' and LLVM='c:/llvm/'
99
# are.
1010

1111
import os
@@ -17,9 +17,6 @@
1717
LLVM_ROOT = os.path.expanduser(os.getenv('LLVM', '{{{ LLVM_ROOT }}}')) # directory
1818
BINARYEN_ROOT = os.path.expanduser(os.getenv('BINARYEN', '')) # if not set, we will use it from ports
1919

20-
# If not specified, defaults to sys.executable.
21-
# PYTHON = 'python'
22-
2320
# Add this if you have manually built the JS optimizer executable (in
2421
# Emscripten/tools/optimizer) and want to run it from a custom location.
2522
# Alternatively, you can set this as the environment variable

‎tools/shared.py

+2-12
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ def generate_config(path, first_time=False):
281281
generate_config(EM_CONFIG, first_time=True)
282282
sys.exit(0)
283283

284+
PYTHON = os.getenv('EM_PYTHON', sys.executable)
285+
284286
# The following globals can be overridden by the config file.
285287
# See parse_config_file below.
286288
NODE_JS = None
@@ -295,7 +297,6 @@ def generate_config(path, first_time=False):
295297
CLOSURE_COMPILER = None
296298
EMSCRIPTEN_NATIVE_OPTIMIZER = None
297299
JAVA = None
298-
PYTHON = None
299300
JS_ENGINE = None
300301
JS_ENGINES = []
301302
COMPILER_OPTS = []
@@ -324,7 +325,6 @@ def parse_config_file():
324325
'CLANG_ADD_VERSION',
325326
'CLOSURE_COMPILER',
326327
'JAVA',
327-
'PYTHON',
328328
'JS_ENGINE',
329329
'JS_ENGINES',
330330
'COMPILER_OPTS',
@@ -531,12 +531,6 @@ def perform_sanify_checks():
531531
if not os.path.exists(cmd) and not os.path.exists(cmd + '.exe'): # .exe extension required for Windows
532532
exit_with_error('Cannot find %s, check the paths in %s', cmd, EM_CONFIG)
533533

534-
if not os.path.exists(PYTHON) and not os.path.exists(cmd + '.exe'):
535-
try:
536-
run_process([PYTHON, '--xversion'], stdout=PIPE, stderr=PIPE)
537-
except (OSError, subprocess.CalledProcessError):
538-
exit_with_error('Cannot find %s, check the paths in config file (%s)', PYTHON, CONFIG_FILE)
539-
540534
# Sanity check passed!
541535
with ToolchainProfiler.profile_block('sanity closure compiler'):
542536
if not check_closure_compiler():
@@ -916,10 +910,6 @@ def apply_configuration():
916910
if CLOSURE_COMPILER is None:
917911
CLOSURE_COMPILER = path_from_root('third_party', 'closure-compiler', 'compiler.jar')
918912

919-
if PYTHON is None:
920-
logger.debug('PYTHON not defined in ' + hint_config_file_location() + ', using "%s"' % (sys.executable,))
921-
PYTHON = sys.executable
922-
923913
if JAVA is None:
924914
logger.debug('JAVA not defined in ' + hint_config_file_location() + ', using "java"')
925915
JAVA = 'java'

0 commit comments

Comments
 (0)
Please sign in to comment.