MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / main

Function main

tools/maint/create_entry_points.py:86–126  ·  view source on GitHub ↗
(all_platforms, use_bat_file)

Source from the content-addressed store, hash-verified

84
85
86def main(all_platforms, use_bat_file):
87 if 'EM_USE_BAT_FILES' in os.environ:
88 use_bat_file = True
89 is_windows = sys.platform.startswith('win')
90 is_msys2 = 'MSYSTEM' in os.environ
91 do_unix = all_platforms or not is_windows or is_msys2
92 do_windows = all_platforms or is_windows
93
94 def generate_entry_points(cmd, path):
95 sh_file = path + '.sh'
96 bat_file = path + '.bat'
97 ps1_file = path + '.ps1'
98 sh_file = read_file(sh_file)
99 bat_file = read_file(bat_file)
100 ps1_file = read_file(ps1_file)
101
102 for entry_point in cmd:
103 sh_data = sh_file
104 bat_data = bat_file
105 ps1_data = ps1_file
106 if entry_point in entry_remap:
107 sh_data = sh_data.replace('$0', '$(dirname $0)/' + entry_remap[entry_point])
108 bat_data = bat_data.replace('%~n0', entry_remap[entry_point].replace('/', '\\'))
109 ps1_data = ps1_data.replace(r"$MyInvocation.MyCommand.Path -replace '\.ps1$', '.py'", fr'"$PSScriptRoot/{entry_remap[entry_point]}.py"')
110
111 launcher = os.path.join(__rootdir__, entry_point)
112 if do_unix:
113 write_file(launcher, sh_data)
114 make_executable(launcher)
115
116 if do_windows:
117 maybe_remove(launcher + '.ps1')
118 maybe_remove(launcher + '.exe')
119 if use_bat_file:
120 write_file(launcher + '.bat', bat_data)
121 write_file(launcher + '.ps1', ps1_data)
122 else:
123 shutil.copyfile(windows_exe, launcher + '.exe')
124
125 generate_entry_points(entry_points, os.path.join(__scriptdir__, 'run_python'))
126 generate_entry_points(compiler_entry_points, os.path.join(__scriptdir__, 'run_python_compiler'))
127
128
129if __name__ == '__main__':

Callers 1

Calls 2

generate_entry_pointsFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected