setuptools version
67.2.0
Python version
3.x
OS
Linux (but presumably applicable to all)
Additional environment information
No response
Description
As of 56a5b33 (setuptools 67.2.0), the distutils.ccompiler.CCompiler.has_function in the setuptools-provided distutils ceased to quote the provided includes in the generated test C file (here).
Therefore, the compilation of the generated test C file always fails.
Expected behavior
The provided includes should be quoted (as before the change) to retain compatibility with older code using this function.
How to Reproduce
- Run the following test code on Linux:
# program.py
import distutils.ccompiler
# Check for `clock` function in the standard library
cc = distutils.ccompiler.new_compiler()
has_clock = cc.has_function('clock', includes=['time.h'])
print("Has clock:" , has_clock)
Output
With setuptools 67.2.0:
$ python program.py
/tmp/clocku2l593gf.c:1:10: error: #include expects "FILENAME" or <FILENAME>
1 | #include time.h
| ^~~~
/tmp/clocku2l593gf.c: In function ‘main’:
/tmp/clocku2l593gf.c:3:5: warning: implicit declaration of function ‘clock’ [-Wimplicit-function-declaration]
3 | clock();
| ^~~~~
/tmp/clocku2l593gf.c:1:1: note: ‘clock’ is defined in header ‘<time.h>’; did you forget to ‘#include <time.h>’?
+++ |+#include <time.h>
1 | #include time.h
Has clock: False
With setuptools 67.1.0:
$ python program.py
Has clock: True
setuptools version
67.2.0
Python version
3.x
OS
Linux (but presumably applicable to all)
Additional environment information
No response
Description
As of 56a5b33 (setuptools 67.2.0), the
distutils.ccompiler.CCompiler.has_functionin thesetuptools-provideddistutilsceased to quote the providedincludesin the generated test C file (here).Therefore, the compilation of the generated test C file always fails.
Expected behavior
The provided
includesshould be quoted (as before the change) to retain compatibility with older code using this function.How to Reproduce
Output
With
setuptools 67.2.0:With
setuptools 67.1.0: