Skip to content

Commit c2ccc1a

Browse files
authored
fix: do not rewrite absolute paths to avoid long paths (#74)
This is an alternative to f2c7618.
1 parent 3d50d22 commit c2ccc1a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pylib/gyp/generator/msvs.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -3614,13 +3614,12 @@ def _AddSources2(
36143614
extension_to_rule_name,
36153615
_GetUniquePlatforms(spec),
36163616
)
3617-
if group == "compile":
3618-
# Always add an <ObjectFileName> value to support duplicate
3619-
# source file basenames.
3617+
if group == "compile" and not os.path.isabs(source):
3618+
# Add an <ObjectFileName> value to support duplicate source
3619+
# file basenames, except for absolute paths to avoid paths
3620+
# with more than 260 characters.
36203621
file_name = os.path.splitext(source)[0] + ".obj"
3621-
if os.path.isabs(file_name):
3622-
file_name = os.path.splitdrive(file_name)[1]
3623-
elif file_name.startswith("..\\"):
3622+
if file_name.startswith("..\\"):
36243623
file_name = re.sub(r"^(\.\.\\)+", "", file_name)
36253624
elif file_name.startswith("$("):
36263625
file_name = re.sub(r"^\$\([^)]+\)\\", "", file_name)

0 commit comments

Comments
 (0)