From 929323f49c0cbc4c3d0147cc190f9cd34ece6e98 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 13 Aug 2022 10:13:26 -0400 Subject: [PATCH] Deprecate behavior in _mangle_base. Ref pypa/distutils#169. --- distutils/ccompiler.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/distutils/ccompiler.py b/distutils/ccompiler.py index 8c9b1d48..c8d3b24b 100644 --- a/distutils/ccompiler.py +++ b/distutils/ccompiler.py @@ -6,6 +6,8 @@ import sys import os import re +import warnings + from distutils.errors import ( CompileError, LinkError, @@ -943,7 +945,16 @@ def _mangle_base(base): # Chop off the drive no_drive = os.path.splitdrive(base)[1] # If abs, chop off leading / - return no_drive[os.path.isabs(no_drive) :] + rel = no_drive[os.path.isabs(no_drive) :] + if rel != base: + msg = ( + f"Absolute path {base!r} is being replaced with a " + f"relative path {rel!r} for outputs. This behavior is " + "deprecated. If this behavior is desired, please " + "comment in pypa/distutils#169." + ) + warnings.warn(msg, DeprecationWarning) + return rel def shared_object_filename(self, basename, strip_dir=0, output_dir=''): assert output_dir is not None