From 37db852d9b1051b30a77af576f6e0571f0b275d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Fri, 16 Oct 2020 08:13:36 +0200 Subject: [PATCH] fix: do not rewrite absolute paths to avoid long paths This is an alternative to f2c761838babf. --- pylib/gyp/generator/msvs.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pylib/gyp/generator/msvs.py b/pylib/gyp/generator/msvs.py index e05a8a78..0d6dddd8 100644 --- a/pylib/gyp/generator/msvs.py +++ b/pylib/gyp/generator/msvs.py @@ -3614,13 +3614,12 @@ def _AddSources2( extension_to_rule_name, _GetUniquePlatforms(spec), ) - if group == "compile": - # Always add an value to support duplicate - # source file basenames. + if group == "compile" and not os.path.isabs(source): + # Add an value to support duplicate source + # file basenames, except for absolute paths to avoid paths + # with more than 260 characters. file_name = os.path.splitext(source)[0] + ".obj" - if os.path.isabs(file_name): - file_name = os.path.splitdrive(file_name)[1] - elif file_name.startswith("..\\"): + if file_name.startswith("..\\"): file_name = re.sub(r"^(\.\.\\)+", "", file_name) elif file_name.startswith("$("): file_name = re.sub(r"^\$\([^)]+\)\\", "", file_name)