pypa / distutils

distutils as found in cpython

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`has_function` broken when `CCompiler.output_dir` is set.

jaraco opened this issue · comments

This has broken has_function when CCompiler.output_dir is set.

Originally posted by @mkoeppe in #31 (comment)

Thanks for opening the issue. We came across this in https://trac.sagemath.org/ticket/32828 (pyzmq fails to build when SETUPTOOLS_USE_DISTUTILS=local is in use).

I looked at the patch and read the problem description, but it's not obvious to me where the flaw is. Do you have any more detail (traceback, repro)?

I tried to reproduce it by building pyzmq, but it built fine:

$ $SETUPTOOLS_USE_DISTUTILS='local' pip-run --no-binary pyzmq pyzmq
Collecting pyzmq
  Downloading pyzmq-22.3.0.tar.gz (1.2 MB)
     |████████████████████████████████| 1.2 MB 5.9 MB/s            
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyzmq
  Building wheel for pyzmq (pyproject.toml) ... done
  Created wheel for pyzmq: filename=pyzmq-22.3.0-cp310-cp310-macosx_10_9_universal2.whl size=1398560 sha256=4fc39ea9b87811527d0a4646025fc45a95a12ba8ea17e9208a35b2c237f5424b
  Stored in directory: /Users/jaraco/Library/Caches/pip/wheels/5c/8a/96/75ce2fe82d6ff5907f6c409b4ee48b8e7876d56047f34aaafa
Successfully built pyzmq
Installing collected packages: pyzmq
Successfully installed pyzmq-22.3.0
Python 3.10.0 (v3.10.0:b494f5935c, Oct  4 2021, 14:59:20) [Clang 12.0.5 (clang-1205.0.22.11)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

It builds for me too - Python-3.8.11, setuptools-58.5.3, pyzmq-22.3 as well as current main branch.

I looked at the patch and read the problem description, but it's not obvious to me where the flaw is

The code is expecting that a.out is created in the current directory, which is not true if output_dir is set.

I've added a testcase in #65