Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ def run_cmd(cmd):
'tools/maint/create_entry_points.py',
'tools/pylauncher/pylauncher.exe',
'tools/maint/run_python.bat',
'tools/maint/run_python.sh',
'tools/run_python.sh',
'tools/run_python_compiler.sh',
'tools/maint/run_python.ps1',
], [sys.executable, 'tools/maint/create_entry_points.py']),
('git submodules', [
Expand Down
33 changes: 18 additions & 15 deletions tools/maint/create_entry_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@

"""Tool for creating/maintaining the python launcher scripts for emscripten tools.

This tool makes copies or `run_python.sh/.bat` and `run_python_compiler.sh/.bat`
script for each entry point. On UNIX we previously used symbolic links for
simplicity but this breaks MINGW users on windows who want to use the shell script
launcher but don't have symlink support.
This tool creates symbolic links (on UNIX) or executables/batch scripts (on Windows)
for each entry point.
"""

import os
Expand Down Expand Up @@ -95,13 +93,13 @@ def main(all_platforms, use_bat_file):
do_unix = all_platforms or not is_windows or is_msys2
do_windows = all_platforms or is_windows

def generate_entry_points(cmd, path):
sh_file = path + '.sh'
bat_file = path + '.bat'
ps1_file = path + '.ps1'
sh_file = read_file(sh_file)
bat_file = read_file(bat_file)
ps1_file = read_file(ps1_file)
def generate_entry_points(cmd, name):
sh_file_path = os.path.join(__rootdir__, 'tools', name + '.sh')
bat_file_path = os.path.join(__scriptdir__, name + '.bat')
ps1_file_path = os.path.join(__scriptdir__, name + '.ps1')
sh_file = read_file(sh_file_path)
bat_file = read_file(bat_file_path)
ps1_file = read_file(ps1_file_path)

for entry_point in cmd:
sh_data = sh_file
Expand All @@ -114,8 +112,13 @@ def generate_entry_points(cmd, path):

launcher = os.path.join(__rootdir__, entry_point)
if do_unix:
write_file(launcher, sh_data)
make_executable(launcher)
if entry_point in entry_remap:
write_file(launcher, sh_data)
make_executable(launcher)
else:
target = os.path.relpath(sh_file_path, os.path.dirname(launcher))
maybe_remove(launcher)
os.symlink(target, launcher)

if do_windows:
maybe_remove(launcher + '.ps1')
Expand All @@ -126,8 +129,8 @@ def generate_entry_points(cmd, path):
else:
shutil.copyfile(windows_exe, launcher + '.exe')

generate_entry_points(entry_points, os.path.join(__scriptdir__, 'run_python'))
generate_entry_points(compiler_entry_points, os.path.join(__scriptdir__, 'run_python_compiler'))
generate_entry_points(entry_points, 'run_python')
generate_entry_points(compiler_entry_points, 'run_python_compiler')


if __name__ == '__main__':
Expand Down
5 changes: 0 additions & 5 deletions tools/maint/run_python.sh → tools/run_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
# found in the LICENSE file.
#
# Entry point for running python scripts on UNIX systems.
#
# Automatically generated by `create_entry_points.py`; DO NOT EDIT.
#
# To make modifications to this file, edit `tools/run_python.sh` and then run
# `tools/maint/create_entry_points.py`

# python -E does not ignore _PYTHON_SYSCONFIGDATA_NAME, an internal of cpython
# used in cross compilation via setup.py, so we unset it explicitly here.
Expand Down
5 changes: 0 additions & 5 deletions tools/maint/run_python_compiler.sh → tools/run_python_compiler.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
# found in the LICENSE file.
#
# Entry point for running python scripts on UNIX systems.
#
# Automatically generated by `create_entry_points.py`; DO NOT EDIT.
#
# To make modifications to this file, edit `tools/maint/run_python_compiler.sh` and
# then run `tools/maint/create_entry_points.py`

# python -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal
# of cpython used in cross compilation via setup.py.
Expand Down
Loading