Use "TEMPFILEARGESCFUNC" for GCC workaround on Windows

This commit is contained in:
Ivan Kravets
2021-01-27 20:30:28 +02:00
parent 7810946484
commit d77dbb2cca
2 changed files with 14 additions and 1 deletions
+13
View File
@@ -16,8 +16,10 @@ from __future__ import absolute_import
import hashlib
import os
import re
from SCons.Platform import TempFileMunge # pylint: disable=import-error
from SCons.Subst import quote_spaces # pylint: disable=import-error
from platformio.compat import WINDOWS, hashlib_encode_data
@@ -27,6 +29,16 @@ from platformio.compat import WINDOWS, hashlib_encode_data
# We need ~256 characters for a temporary file path
MAX_LINE_LENGTH = (8192 if WINDOWS else 131072) - 256
WINPATHSEP_RE = re.compile(r"\\([^\"'\\]|$)")
def tempfile_arg_esc_func(arg):
arg = quote_spaces(arg)
if not WINDOWS:
return arg
# GCC requires double Windows slashes, let's use UNIX separator
return WINPATHSEP_RE.sub(r"/\1", arg)
def long_sources_hook(env, sources):
_sources = str(sources).replace("\\", "/")
@@ -67,6 +79,7 @@ def generate(env):
_long_sources_hook=long_sources_hook,
TEMPFILE=TempFileMunge,
MAXLINELENGTH=MAX_LINE_LENGTH,
TEMPFILEARGESCFUNC=tempfile_arg_esc_func,
TEMPFILESUFFIX=".tmp",
TEMPFILEDIR="$BUILD_DIR",
)