Skip to content

Commit da60a87

Browse files
authored
fix: fix FileNotFoundError for build_win.bat (#7399)
fix FileNotFoundError for build_win.bat `FileNotFoundError: [WinError 2] 系统找不到指定的文件。ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel` Signed-off-by: gjj2828 <[email protected]> Co-authored-by: gjj2828 <[email protected]>
1 parent e6324af commit da60a87

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

setup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,12 @@ def op_enabled(op_name):
203203
print(f'Install Ops={install_ops}')
204204

205205
# Write out version/git info.
206-
git_hash_cmd = shlex.split("bash -c \"git rev-parse --short HEAD\"")
207-
git_branch_cmd = shlex.split("bash -c \"git rev-parse --abbrev-ref HEAD\"")
206+
if sys.platform == "win32":
207+
git_hash_cmd = shlex.split("git rev-parse --short HEAD")
208+
git_branch_cmd = shlex.split("git rev-parse --abbrev-ref HEAD")
209+
else:
210+
git_hash_cmd = shlex.split("bash -c \"git rev-parse --short HEAD\"")
211+
git_branch_cmd = shlex.split("bash -c \"git rev-parse --abbrev-ref HEAD\"")
208212
if command_exists('git') and not is_env_set('DS_BUILD_STRING'):
209213
try:
210214
result = subprocess.check_output(git_hash_cmd)

0 commit comments

Comments
 (0)