summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2022-08-21 13:28:05 -0400
committerJason R. Coombs <jaraco@jaraco.com>2022-08-21 13:29:03 -0400
commitea04533962eb5ac86630b9cc65e4a5d5c6cfef55 (patch)
treebe642e4148ab07047329baf2198dd46831ff93d8
parent9c4dc4955c2a81891e96cfef97692e80dcf4f563 (diff)
downloadpython-setuptools-git-ea04533962eb5ac86630b9cc65e4a5d5c6cfef55.tar.gz
Rename _mangle_base to _make_relative and add documentation about its purpose. Ref pypa/distutils#169.
-rw-r--r--conftest.py2
-rw-r--r--distutils/ccompiler.py8
2 files changed, 6 insertions, 4 deletions
diff --git a/conftest.py b/conftest.py
index feac1b60..018e1075 100644
--- a/conftest.py
+++ b/conftest.py
@@ -154,5 +154,5 @@ def suppress_path_mangle(monkeysession):
from distutils import ccompiler
monkeysession.setattr(
- ccompiler.CCompiler, '_mangle_base', staticmethod(lambda x: x)
+ ccompiler.CCompiler, '_make_relative', staticmethod(lambda x: x)
)
diff --git a/distutils/ccompiler.py b/distutils/ccompiler.py
index c8d3b24b..6b168792 100644
--- a/distutils/ccompiler.py
+++ b/distutils/ccompiler.py
@@ -927,7 +927,7 @@ int main (int argc, char **argv) {
obj_names = []
for src_name in source_filenames:
base, ext = os.path.splitext(src_name)
- base = self._mangle_base(base)
+ base = self._make_relative(base)
if ext not in self.src_extensions:
raise UnknownFileError(
"unknown file type '{}' (from '{}')".format(ext, src_name)
@@ -938,9 +938,11 @@ int main (int argc, char **argv) {
return obj_names
@staticmethod
- def _mangle_base(base):
+ def _make_relative(base):
"""
- For unknown reasons, absolute paths are mangled.
+ In order to ensure that a filename always honors the
+ indicated output_dir, make sure it's relative.
+ Ref python/cpython#37775.
"""
# Chop off the drive
no_drive = os.path.splitdrive(base)[1]