[BUG] Compiler commands are no longer logged in some cases
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
setuptools version
65.6.0
Python version
Python 3.10
OS
Linux
Additional environment information
No response
Description
From setuptools 65.6.0 on, a python setup.py build_ext --inplace no longer logs the individual compiler commands that are executed when SETUPTOOLS_USE_DISTUTILS=local if distutils.core.setup is used. They were logged in setuptools 65.5.1, however, and are logged if setuptools.setup is used.
Expected behavior
Compiler commands should be logged by default, and setuptools.setup and distutils.core.setup should behave identically when SETUPTOOLS_USE_DISTUTILS=local
How to Reproduce
- Create a temp directory to work in:
mkdir /tmp/setuptools_compiler_output cd /tmp/setuptools_compiler_output- Create a sample
setup.pyand extension module:
$ cat >setup.py <<EOF
from distutils.core import Extension, setup
setup(
name="foo",
version="0.0.1",
ext_modules=[
Extension(name="foo", sources=["foo.c"]),
],
)
EOF
- Create a sample extension module:
$ cat >foo.c <<EOF
#define PY_SSIZE_T_CLEAN
#include <Python.h>
static PyMethodDef methods[] = {
{NULL, NULL, 0, NULL}
};
static struct PyModuleDef module = {
PyModuleDef_HEAD_INIT,
"foo",
NULL,
-1,
methods
};
PyMODINIT_FUNC
PyInit_foo(void)
{
return PyModule_Create(&module);
}
EOF
python3 -m venv venv. venv/bin/activatepip install -q setuptools==65.6.0SETUPTOOLS_USE_DISTUTILS=local python setup.py build_ext --inplace
Observe that no compiler/linker commands are printed.
- Clean up after the build:
rm -rf build foo*.so pip install -q setuptools==65.5.1SETUPTOOLS_USE_DISTUTILS=local python setup.py build_ext --inplace
Observe that the compiler/linker commands are printed.
Output
$ mkdir /tmp/setuptools_compiler_output
$ cd /tmp/setuptools_compiler_output
$ cat >setup.py <<EOF
from distutils.core import Extension, setup
setup(
name="foo",
version="0.0.1",
ext_modules=[
Extension(name="foo", sources=["foo.c"]),
],
)
EOF
$ cat >foo.c <<EOF
#define PY_SSIZE_T_CLEAN
#include <Python.h>
static PyMethodDef methods[] = {
{NULL, NULL, 0, NULL}
};
static struct PyModuleDef module = {
PyModuleDef_HEAD_INIT,
"foo",
NULL,
-1,
methods
};
PyMODINIT_FUNC
PyInit_foo(void)
{
return PyModule_Create(&module);
}
EOF
$ python3 -m venv venv
$ . venv/bin/activate
(venv) $ pip install -q setuptools==65.6.0
(venv) $ SETUPTOOLS_USE_DISTUTILS=local python setup.py build_ext --inplace
(venv) $ rm -rf build foo*.so
(venv) $ pip install -q setuptools==65.5.1
(venv) $ SETUPTOOLS_USE_DISTUTILS=local python setup.py build_ext --inplace
running build_ext
building 'foo' extension
creating build
creating build/temp.linux-x86_64-cpython-310
gcc <snip> -c foo.c -o build/temp.linux-x86_64-cpython-310/foo.o
creating build/lib.linux-x86_64-cpython-310
gcc <snip> build/temp.linux-x86_64-cpython-310/foo.o -o build/lib.linux-x86_64-cpython-310/foo.cpython-310-x86_64-linux-gnu.so
copying build/lib.linux-x86_64-cpython-310/foo.cpython-310-x86_64-linux-gnu.so ->
(venv) $
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the sample setup.py, foo.c extension, and SETUPTOOLS_USE_DISTUTILS=local command described in the report. Compare setuptools 65.6.0 with 65.5.1 and compare distutils.core.setup with setuptools.setup; done means compiler and linker commands are logged consistently by default.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100