From b7251368ccc55d2597acfa3c715c790d6ffdd8fe Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Mon, 4 Aug 2025 13:21:56 -0700 Subject: [PATCH] Only create compiler entry points for the current platform (by default) --- tools/maint/create_entry_points.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/tools/maint/create_entry_points.py b/tools/maint/create_entry_points.py index 0e26402d17dbc..72bbdfe592ca4 100755 --- a/tools/maint/create_entry_points.py +++ b/tools/maint/create_entry_points.py @@ -60,7 +60,11 @@ } -def main(): +def main(all_platforms): + is_windows = sys.platform.startswith('win') + do_unix = all_platforms or not is_windows + do_windows = all_platforms or is_windows + def generate_entry_points(cmd, path): sh_file = path + '.sh' bat_file = path + '.bat' @@ -81,20 +85,22 @@ def generate_entry_points(cmd, path): bat_data = bat_data.replace('%~n0', entry_remap[entry_point].replace('/', '\\')) ps1_data = ps1_data.replace(r"$MyInvocation.MyCommand.Path -replace '\.ps1$', '.py'", fr'"$PSScriptRoot/{entry_remap[entry_point]}.py"') - out_sh_file = os.path.join(__rootdir__, entry_point) - with open(out_sh_file, 'w') as f: - f.write(sh_data) - os.chmod(out_sh_file, stat.S_IMODE(os.stat(out_sh_file).st_mode) | stat.S_IXUSR) + if do_unix: + out_sh_file = os.path.join(__rootdir__, entry_point) + with open(out_sh_file, 'w') as f: + f.write(sh_data) + os.chmod(out_sh_file, stat.S_IMODE(os.stat(out_sh_file).st_mode) | stat.S_IXUSR) - with open(os.path.join(__rootdir__, entry_point + '.bat'), 'w') as f: - f.write(bat_data) + if do_windows: + with open(os.path.join(__rootdir__, entry_point + '.bat'), 'w') as f: + f.write(bat_data) - with open(os.path.join(__rootdir__, entry_point + '.ps1'), 'w') as f: - f.write(ps1_data) + with open(os.path.join(__rootdir__, entry_point + '.ps1'), 'w') as f: + f.write(ps1_data) generate_entry_points(entry_points, os.path.join(__scriptdir__, 'run_python')) generate_entry_points(compiler_entry_points, os.path.join(__scriptdir__, 'run_python_compiler')) if __name__ == '__main__': - sys.exit(main()) + sys.exit(main('--all' in sys.argv))