@@ -353,7 +353,7 @@ code.
353353
354354The keywords arguments to ``set_source() `` control how the C compiler
355355will be called. They are passed directly to distutils _ or setuptools _
356- and include at least ``sources ``, ``include_dirs ``, ``define_macros ``,
356+ and include at least ``sources ``, ``depends ``, `` include_dirs ``, ``define_macros ``,
357357``undef_macros ``, ``libraries ``, ``library_dirs ``, ``extra_objects ``,
358358``extra_compile_args `` and ``extra_link_args ``. You typically need at
359359least ``libraries=['foo'] `` in order to link with ``libfoo.so `` or
@@ -367,6 +367,17 @@ first argument to ``sources``). See the distutils documentation for
367367.. _distutils : http://docs.python.org/3.11/distutils/setupscript.html#describing-extension-modules
368368.. _setuptools : https://setuptools.pypa.io/
369369
370+ If your C sources include project-local header files, list those files in
371+ ``depends ``, for example ``depends=['pi.h'] ``. Setuptools uses this list
372+ both to detect when an extension needs rebuilding and to include the files
373+ in a source distribution. Use paths relative to the project root.
374+ ``include_dirs `` only tells the compiler where to search for headers; it
375+ does not add those headers to the source distribution. Without them, a
376+ wheel built from the source distribution (as done by ``python -m build ``)
377+ can fail even if compilation from the working tree succeeds. List the
378+ headers themselves, including any project-local headers they include;
379+ ``depends `` does not recursively discover ``#include `` dependencies.
380+
370381An extra keyword argument processed internally is
371382``source_extension ``, defaulting to ``".c" ``. The file generated will
372383be actually called ``module_name + source_extension ``. Example for
0 commit comments