mirror of https://github.com/python/cpython
bpo-45595: Make extensions depend on header files (GH-29198)
``setup.py`` and ``makesetup`` now track build dependencies on all Python header files and module specific header files. Signed-off-by: Christian Heimes <christian@python.org>
This commit is contained in:
parent
77e3f224d6
commit
81669d1b7b
|
@ -2117,6 +2117,28 @@ Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h
|
|||
.PHONY: build_all_generate_profile build_all_merge_profile
|
||||
.PHONY: gdbhooks
|
||||
|
||||
##########################################################################
|
||||
# Module dependencies
|
||||
|
||||
MODULE_CMATH_DEPS=$(srcdir)/Modules/_math.h $(srcdir)/Modules/_math.c
|
||||
MODULE_MATH_DEPS=$(srcdir)/Modules/_math.h $(srcdir)/Modules/_math.c
|
||||
MODULE_PYEXPAT_DEPS=$(srcdir)/Modules/expat/ascii.h $(srcdir)/Modules/expat/asciitab.h $(srcdir)/Modules/expat/expat.h $(srcdir)/Modules/expat/expat_config.h $(srcdir)/Modules/expat/expat_external.h $(srcdir)/Modules/expat/internal.h $(srcdir)/Modules/expat/latin1tab.h $(srcdir)/Modules/expat/utf8tab.h $(srcdir)/Modules/expat/xmlrole.h $(srcdir)/Modules/expat/xmltok.h $(srcdir)/Modules/expat/xmltok_impl.h
|
||||
MODULE_UNICODEDATA_DEPS=$(srcdir)/Modules/unicodedata_db.h $(srcdir)/Modules/unicodename_db.h
|
||||
MODULE__BLAKE2_DEPS=$(srcdir)/Modules/_blake2/impl/blake2-config.h $(srcdir)/Modules/_blake2/impl/blake2-dispatch.c $(srcdir)/Modules/_blake2/impl/blake2-impl.h $(srcdir)/Modules/_blake2/impl/blake2-kat.h $(srcdir)/Modules/_blake2/impl/blake2.h $(srcdir)/Modules/_blake2/impl/blake2b-load-sse2.h $(srcdir)/Modules/_blake2/impl/blake2b-load-sse41.h $(srcdir)/Modules/_blake2/impl/blake2b-ref.c $(srcdir)/Modules/_blake2/impl/blake2b-round.h $(srcdir)/Modules/_blake2/impl/blake2b-test.c $(srcdir)/Modules/_blake2/impl/blake2b.c $(srcdir)/Modules/_blake2/impl/blake2bp-test.c $(srcdir)/Modules/_blake2/impl/blake2bp.c $(srcdir)/Modules/_blake2/impl/blake2s-load-sse2.h $(srcdir)/Modules/_blake2/impl/blake2s-load-sse41.h $(srcdir)/Modules/_blake2/impl/blake2s-load-xop.h $(srcdir)/Modules/_blake2/impl/blake2s-ref.c $(srcdir)/Modules/_blake2/impl/blake2s-round.h $(srcdir)/Modules/_blake2/impl/blake2s-test.c $(srcdir)/Modules/_blake2/impl/blake2s.c $(srcdir)/Modules/_blake2/impl/blake2sp-test.c $(srcdir)/Modules/_blake2/impl/blake2sp.c $(srcdir)/Modules/hashlib.h
|
||||
MODULE__CTYPES_DEPS=$(srcdir)/Modules/_ctypes/ctypes.h
|
||||
MODULE__DECIMAL_DEPS=$(srcdir)/Modules/_decimal/docstrings.h $(srcdir)/Modules/_decimal/libmpdec/basearith.h $(srcdir)/Modules/_decimal/libmpdec/bits.h $(srcdir)/Modules/_decimal/libmpdec/constants.h $(srcdir)/Modules/_decimal/libmpdec/convolute.h $(srcdir)/Modules/_decimal/libmpdec/crt.h $(srcdir)/Modules/_decimal/libmpdec/difradix2.h $(srcdir)/Modules/_decimal/libmpdec/fnt.h $(srcdir)/Modules/_decimal/libmpdec/fourstep.h $(srcdir)/Modules/_decimal/libmpdec/io.h $(srcdir)/Modules/_decimal/libmpdec/mpalloc.h $(srcdir)/Modules/_decimal/libmpdec/mpdecimal.h $(srcdir)/Modules/_decimal/libmpdec/numbertheory.h $(srcdir)/Modules/_decimal/libmpdec/sixstep.h $(srcdir)/Modules/_decimal/libmpdec/transpose.h $(srcdir)/Modules/_decimal/libmpdec/typearith.h $(srcdir)/Modules/_decimal/libmpdec/umodarith.h
|
||||
MODULE__ELEMENTTREE_DEPS=$(srcdir)/Modules/expat/ascii.h $(srcdir)/Modules/expat/asciitab.h $(srcdir)/Modules/expat/expat.h $(srcdir)/Modules/expat/expat_config.h $(srcdir)/Modules/expat/expat_external.h $(srcdir)/Modules/expat/internal.h $(srcdir)/Modules/expat/latin1tab.h $(srcdir)/Modules/expat/utf8tab.h $(srcdir)/Modules/expat/xmlparse.c $(srcdir)/Modules/expat/xmlrole.c $(srcdir)/Modules/expat/xmlrole.h $(srcdir)/Modules/expat/xmltok.c $(srcdir)/Modules/expat/xmltok.h $(srcdir)/Modules/expat/xmltok_impl.h $(srcdir)/Modules/pyexpat.c
|
||||
MODULE__HASHLIB_DEPS=$(srcdir)/Modules/hashlib.h
|
||||
MODULE__IO_DEPS=$(srcdir)/Modules/_io/_iomodule.h
|
||||
MODULE__MD5_DEPS=$(srcdir)/Modules/hashlib.h
|
||||
MODULE__SHA1_DEPS=$(srcdir)/Modules/hashlib.h
|
||||
MODULE__SHA256_DEPS=$(srcdir)/Modules/hashlib.h
|
||||
MODULE__SHA3_DEPS=$(srcdir)/Modules/_sha3/kcp/KeccakHash.c $(srcdir)/Modules/_sha3/kcp/KeccakHash.h $(srcdir)/Modules/_sha3/kcp/KeccakP-1600-64.macros $(srcdir)/Modules/_sha3/kcp/KeccakP-1600-SnP-opt32.h $(srcdir)/Modules/_sha3/kcp/KeccakP-1600-SnP-opt64.h $(srcdir)/Modules/_sha3/kcp/KeccakP-1600-SnP.h $(srcdir)/Modules/_sha3/kcp/KeccakP-1600-inplace32BI.c $(srcdir)/Modules/_sha3/kcp/KeccakP-1600-opt64-config.h $(srcdir)/Modules/_sha3/kcp/KeccakP-1600-opt64.c $(srcdir)/Modules/_sha3/kcp/KeccakP-1600-unrolling.macros $(srcdir)/Modules/_sha3/kcp/KeccakSponge.c $(srcdir)/Modules/_sha3/kcp/KeccakSponge.h $(srcdir)/Modules/_sha3/kcp/KeccakSponge.inc $(srcdir)/Modules/_sha3/kcp/PlSnP-Fallback.inc $(srcdir)/Modules/_sha3/kcp/SnP-Relaned.h $(srcdir)/Modules/_sha3/kcp/align.h $(srcdir)/Modules/hashlib.h
|
||||
MODULE__SHA512_DEPS=$(srcdir)/Modules/hashlib.h
|
||||
MODULE__SOCKET_DEPS=$(srcdir)/Modules/socketmodule.h
|
||||
MODULE__SSL_DEPS=$(srcdir)/Modules/_ssl.h $(srcdir)/Modules/_ssl/cert.c $(srcdir)/Modules/_ssl/debughelpers.c $(srcdir)/Modules/_ssl/misc.c $(srcdir)/Modules/_ssl_data.h $(srcdir)/Modules/_ssl_data_111.h $(srcdir)/Modules/_ssl_data_300.h $(srcdir)/Modules/socketmodule.h
|
||||
MODULE__TESTCAPI_DEPS=$(srcdir)/Modules/testcapi_long.h
|
||||
|
||||
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
|
||||
# Local Variables:
|
||||
# mode: makefile
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
``setup.py`` and ``makesetup`` now track build dependencies on all Python
|
||||
header files and module specific header files.
|
|
@ -235,7 +235,8 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
|
|||
*)
|
||||
cc="$cc \$(PY_BUILTIN_MODULE_CFLAGS)";;
|
||||
esac
|
||||
rule="$obj: $src; $cc $cpps -c $src -o $obj"
|
||||
mods_upper=$(echo $mods | tr '[a-z]' '[A-Z]')
|
||||
rule="$obj: $src \$(MODULE_${mods_upper}_DEPS) \$(PYTHON_HEADERS); $cc $cpps -c \$< -o \$@"
|
||||
echo "$rule" >>$rulesf
|
||||
done
|
||||
case $doconfig in
|
||||
|
@ -248,7 +249,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
|
|||
no) SHAREDMODS="$SHAREDMODS $file";;
|
||||
esac
|
||||
rule="$file: $objs"
|
||||
rule="$rule; \$(BLDSHARED) $objs $libs $ExtraLibs -o $file"
|
||||
rule="$rule; \$(BLDSHARED) $objs $libs $ExtraLibs -o \$@"
|
||||
echo "$rule" >>$rulesf
|
||||
done
|
||||
done
|
||||
|
|
8
setup.py
8
setup.py
|
@ -409,8 +409,11 @@ class PyBuildExt(build_ext):
|
|||
for filename in self.distribution.scripts]
|
||||
|
||||
# Python header files
|
||||
include_dir = escape(sysconfig.get_path('include'))
|
||||
headers = [sysconfig.get_config_h_filename()]
|
||||
headers += glob(os.path.join(escape(sysconfig.get_path('include')), "*.h"))
|
||||
headers.extend(glob(os.path.join(include_dir, "*.h")))
|
||||
headers.extend(glob(os.path.join(include_dir, "cpython", "*.h")))
|
||||
headers.extend(glob(os.path.join(include_dir, "internal", "*.h")))
|
||||
|
||||
for ext in self.extensions:
|
||||
ext.sources = [ find_module_file(filename, moddirlist)
|
||||
|
@ -2473,6 +2476,9 @@ class PyBuildExt(build_ext):
|
|||
depends=[
|
||||
'socketmodule.h',
|
||||
'_ssl.h',
|
||||
'_ssl_data_111.h',
|
||||
'_ssl_data_300.h',
|
||||
'_ssl_data.h',
|
||||
'_ssl/debughelpers.c',
|
||||
'_ssl/misc.c',
|
||||
'_ssl/cert.c',
|
||||
|
|
Loading…
Reference in New Issue