From 5822c59ea5b49e0366c6c48a2d6653607c198a5f Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Thu, 22 Aug 2024 23:29:34 -0400 Subject: [PATCH] [Build] Remove .exe suffix on windows Windows executable will have .exe suffix. It will cause illegal python code `def flat.exe():` generated. This change fix the issue by remove the suffix. For #4661 --- build/pip_data_bin_init.py.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/pip_data_bin_init.py.in b/build/pip_data_bin_init.py.in index 9644c5621d..0c9d60e049 100644 --- a/build/pip_data_bin_init.py.in +++ b/build/pip_data_bin_init.py.in @@ -21,7 +21,9 @@ def _find_executable_files_under(dir): for filename in os.listdir(dir): filepath = os.path.join(dir, filename) if os.path.isfile(filepath) and os.access(filepath, os.X_OK): - bin_names.append(filename) + # Remove .exe suffix on windows. + filename_without_ext = os.path.splitext(filename)[0] + bin_names.append(filename_without_ext) return bin_names # The list of binaries to create wrapper functions for.