diff --git a/third_party/py/rules_python.patch b/third_party/py/rules_python.patch index bf22eaa7b..97a78f47c 100644 --- a/third_party/py/rules_python.patch +++ b/third_party/py/rules_python.patch @@ -71,3 +71,24 @@ index 774c24d1..91e59f9b 100644 "3.13": "3.13.0", } +diff --git a/python/private/python_bootstrap_template.txt b/python/private/python_bootstrap_template.txt +index 0f9c90b3..2a5e005a 100644 +--- a/python/private/python_bootstrap_template.txt ++++ b/python/private/python_bootstrap_template.txt +@@ -52,8 +52,14 @@ def GetWindowsPathWithUNCPrefix(path): + # removed from common Win32 file and directory functions. + # Related doc: https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later + import platform +- if platform.win32_ver()[1] >= '10.0.14393': +- return path ++ try: ++ version = platform.win32_ver()[1] ++ except ValueError e: ++ if "invalid literal for int() with base 10" in str(e): ++ version = platform.win32_ver()[1] ++ finally: ++ if version >= '10.0.14393': ++ return path + + # import sysconfig only now to maintain python 2.6 compatibility + import sysconfig