| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -356,6 +356,12 @@ Changes in the Python API | |||
| 356 | 356 | Build Changes | |
| 357 | 357 | ============= | |
| 358 | 358 | ||
| 359 | + * Python no longer uses ``setup.py`` to build shared C extension modules. | ||
| 360 | + Build parameters like headers and libraries are detected in ``configure`` | ||
| 361 | + script. Extensions are built by ``Makefile``. Most extensions use | ||
| 362 | + ``pkg-config`` and fall back to manual detection. | ||
| 363 | + (Contributed by Christian Heimes in :gh:`93939`.) | ||
| 364 | + | ||
| 359 | 365 | * ``va_start()`` with two parameters, like ``va_start(args, format),`` | |
| 360 | 366 | is now required to build Python. | |
| 361 | 367 | ``va_start()`` is no longer called with a single parameter. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,6 +21,11 @@ | |||
| 21 | 21 | except ImportError: | |
| 22 | 22 | _testcapi = None | |
| 23 | 23 | ||
| 24 | + try: | ||
| 25 | + import xxsubtype | ||
| 26 | + except ImportError: | ||
| 27 | + xxsubtype = None | ||
| 28 | + | ||
| 24 | 29 | ||
| 25 | 30 | class OperatorsTest(unittest.TestCase): | |
| 26 | 31 | ||
@@ -299,6 +304,7 @@ def test_explicit_reverse_methods(self): | |||
| 299 | 304 | self.assertEqual(float.__rsub__(3.0, 1), -2.0) | |
| 300 | 305 | ||
| 301 | 306 | @support.impl_detail("the module 'xxsubtype' is internal") | |
| 307 | + @unittest.skipIf(xxsubtype is None, "requires xxsubtype module") | ||
| 302 | 308 | def test_spam_lists(self): | |
| 303 | 309 | # Testing spamlist operations... | |
| 304 | 310 | import copy, xxsubtype as spam | |
@@ -343,6 +349,7 @@ def foo(self): return 1 | |||
| 343 | 349 | self.assertEqual(a.getstate(), 42) | |
| 344 | 350 | ||
| 345 | 351 | @support.impl_detail("the module 'xxsubtype' is internal") | |
| 352 | + @unittest.skipIf(xxsubtype is None, "requires xxsubtype module") | ||
| 346 | 353 | def test_spam_dicts(self): | |
| 347 | 354 | # Testing spamdict operations... | |
| 348 | 355 | import copy, xxsubtype as spam | |
@@ -1600,6 +1607,7 @@ def test_refleaks_in_classmethod___init__(self): | |||
| 1600 | 1607 | self.assertAlmostEqual(gettotalrefcount() - refs_before, 0, delta=10) | |
| 1601 | 1608 | ||
| 1602 | 1609 | @support.impl_detail("the module 'xxsubtype' is internal") | |
| 1610 | + @unittest.skipIf(xxsubtype is None, "requires xxsubtype module") | ||
| 1603 | 1611 | def test_classmethods_in_c(self): | |
| 1604 | 1612 | # Testing C-based class methods... | |
| 1605 | 1613 | import xxsubtype as spam | |
@@ -1683,6 +1691,7 @@ def test_refleaks_in_staticmethod___init__(self): | |||
| 1683 | 1691 | self.assertAlmostEqual(gettotalrefcount() - refs_before, 0, delta=10) | |
| 1684 | 1692 | ||
| 1685 | 1693 | @support.impl_detail("the module 'xxsubtype' is internal") | |
| 1694 | + @unittest.skipIf(xxsubtype is None, "requires xxsubtype module") | ||
| 1686 | 1695 | def test_staticmethods_in_c(self): | |
| 1687 | 1696 | # Testing C-based static methods... | |
| 1688 | 1697 | import xxsubtype as spam | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -211,12 +211,6 @@ ENSUREPIP= @ENSUREPIP@ | |||
| 211 | 211 | LIBMPDEC_A= Modules/_decimal/libmpdec/libmpdec.a | |
| 212 | 212 | LIBEXPAT_A= Modules/expat/libexpat.a | |
| 213 | 213 | ||
| 214 | - # OpenSSL options for setup.py so sysconfig can pick up AC_SUBST() vars. | ||
| 215 | - OPENSSL_INCLUDES=@OPENSSL_INCLUDES@ | ||
| 216 | - OPENSSL_LIBS=@OPENSSL_LIBS@ | ||
| 217 | - OPENSSL_LDFLAGS=@OPENSSL_LDFLAGS@ | ||
| 218 | - OPENSSL_RPATH=@OPENSSL_RPATH@ | ||
| 219 | - | ||
| 220 | 214 | # Module state, compiler flags and linker flags | |
| 221 | 215 | # Empty CFLAGS and LDFLAGS are omitted. | |
| 222 | 216 | # states: | |
@@ -582,9 +576,10 @@ LIBEXPAT_HEADERS= \ | |||
| 582 | 576 | ||
| 583 | 577 | # Default target | |
| 584 | 578 | all: @DEF_MAKE_ALL_RULE@ | |
| 585 | - build_all: check-clean-src $(BUILDPYTHON) platform oldsharedmods sharedmods \ | ||
| 586 | - gdbhooks Programs/_testembed scripts | ||
| 587 | - build_wasm: check-clean-src $(BUILDPYTHON) platform oldsharedmods python-config | ||
| 579 | + build_all: check-clean-src $(BUILDPYTHON) platform sharedmods \ | ||
| 580 | + gdbhooks Programs/_testembed scripts checksharedmods | ||
| 581 | + build_wasm: check-clean-src $(BUILDPYTHON) platform sharedmods \ | ||
| 582 | + python-config checksharedmods | ||
| 588 | 583 | ||
| 589 | 584 | # Check that the source is clean when building out of source. | |
| 590 | 585 | check-clean-src: | |
@@ -726,22 +721,6 @@ $(srcdir)/Modules/_blake2/blake2s_impl.c: $(srcdir)/Modules/_blake2/blake2b_impl | |||
| 726 | 721 | $(PYTHON_FOR_REGEN) $(srcdir)/Modules/_blake2/blake2b2s.py | |
| 727 | 722 | $(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py -f $@ | |
| 728 | 723 | ||
| 729 | - # Build the shared modules | ||
| 730 | - # Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for | ||
| 731 | - # -s, --silent or --quiet is always the first char. | ||
| 732 | - # Under BSD make, MAKEFLAGS might be " -s -v x=y". | ||
| 733 | - # Ignore macros passed by GNU make, passed after -- | ||
| 734 | - sharedmods: $(PYTHON_FOR_BUILD_DEPS) pybuilddir.txt @LIBMPDEC_INTERNAL@ @LIBEXPAT_INTERNAL@ | ||
| 735 | - @case "`echo X $$MAKEFLAGS | sed 's/^X //;s/ -- .*//'`" in \ | ||
| 736 | - *\ -s*|s*) quiet="-q";; \ | ||
| 737 | - *) quiet="";; \ | ||
| 738 | - esac; \ | ||
| 739 | - echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ | ||
| 740 | - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ | ||
| 741 | - $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ | ||
| 742 | - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build | ||
| 743 | - | ||
| 744 | - | ||
| 745 | 724 | # Build static library | |
| 746 | 725 | $(LIBRARY): $(LIBRARY_OBJS) | |
| 747 | 726 | -rm -f $@ | |
@@ -832,10 +811,6 @@ python.worker.js: $(srcdir)/Tools/wasm/python.worker.js | |||
| 832 | 811 | # Build static libmpdec.a | |
| 833 | 812 | LIBMPDEC_CFLAGS=@LIBMPDEC_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED) | |
| 834 | 813 | ||
| 835 | - # for setup.py | ||
| 836 | - DECIMAL_CFLAGS=@LIBMPDEC_CFLAGS@ | ||
| 837 | - DECIMAL_LDFLAGS=@LIBMPDEC_LDFLAGS@ | ||
| 838 | - | ||
| 839 | 814 | # "%.o: %c" is not portable | |
| 840 | 815 | Modules/_decimal/libmpdec/basearith.o: $(srcdir)/Modules/_decimal/libmpdec/basearith.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS) | |
| 841 | 816 | $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/basearith.c | |
@@ -890,10 +865,6 @@ $(LIBMPDEC_A): $(LIBMPDEC_OBJS) | |||
| 890 | 865 | # Build static libexpat.a | |
| 891 | 866 | LIBEXPAT_CFLAGS=@LIBEXPAT_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED) | |
| 892 | 867 | ||
| 893 | - # for setup.py | ||
| 894 | - EXPAT_CFLAGS=@LIBEXPAT_CFLAGS@ | ||
| 895 | - EXPAT_LDFLAGS=@LIBEXPAT_LDFLAGS@ | ||
| 896 | - | ||
| 897 | 868 | Modules/expat/xmlparse.o: $(srcdir)/Modules/expat/xmlparse.c $(LIBEXPAT_HEADERS) $(PYTHON_HEADERS) | |
| 898 | 869 | $(CC) -c $(LIBEXPAT_CFLAGS) -o $@ $(srcdir)/Modules/expat/xmlparse.c | |
| 899 | 870 | ||
@@ -910,7 +881,7 @@ $(LIBEXPAT_A): $(LIBEXPAT_OBJS) | |||
| 910 | 881 | # create relative links from build/lib.platform/egg.so to Modules/egg.so | |
| 911 | 882 | # pybuilddir.txt is created too late. We cannot use it in Makefile | |
| 912 | 883 | # targets. ln --relative is not portable. | |
| 913 | - oldsharedmods: $(SHAREDMODS) pybuilddir.txt | ||
| 884 | + sharedmods: $(SHAREDMODS) pybuilddir.txt | ||
| 914 | 885 | @target=`cat pybuilddir.txt`; \ | |
| 915 | 886 | $(MKDIR_P) $$target; \ | |
| 916 | 887 | for mod in X $(SHAREDMODS); do \ | |
@@ -919,7 +890,8 @@ oldsharedmods: $(SHAREDMODS) pybuilddir.txt | |||
| 919 | 890 | fi; \ | |
| 920 | 891 | done | |
| 921 | 892 | ||
| 922 | - checksharedmods: oldsharedmods sharedmods $(PYTHON_FOR_BUILD_DEPS) | ||
| 893 | + # dependency on BUILDPYTHON ensures that the target is run last | ||
| 894 | + checksharedmods: sharedmods $(PYTHON_FOR_BUILD_DEPS) $(BUILDPYTHON) | ||
| 923 | 895 | @$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/check_extension_modules.py | |
| 924 | 896 | ||
| 925 | 897 | Modules/Setup.local: | |
@@ -942,7 +914,7 @@ Makefile Modules/config.c: Makefile.pre \ | |||
| 942 | 914 | $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \ | |
| 943 | 915 | -s Modules \ | |
| 944 | 916 | Modules/Setup.local \ | |
| 945 | - @MODULES_SETUP_STDLIB@ \ | ||
| 917 | + Modules/Setup.stdlib \ | ||
| 946 | 918 | Modules/Setup.bootstrap \ | |
| 947 | 919 | $(srcdir)/Modules/Setup | |
| 948 | 920 | @mv config.c Modules | |
@@ -1762,13 +1734,13 @@ altinstall: commoninstall | |||
| 1762 | 1734 | ||
| 1763 | 1735 | commoninstall: check-clean-src @FRAMEWORKALTINSTALLFIRST@ \ | |
| 1764 | 1736 | altbininstall libinstall inclinstall libainstall \ | |
| 1765 | - sharedinstall oldsharedinstall altmaninstall \ | ||
| 1737 | + sharedinstall altmaninstall \ | ||
| 1766 | 1738 | @FRAMEWORKALTINSTALLLAST@ | |
| 1767 | 1739 | ||
| 1768 | 1740 | # Install shared libraries enabled by Setup | |
| 1769 | 1741 | DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED) | |
| 1770 | 1742 | ||
| 1771 | - oldsharedinstall: $(DESTSHARED) all | ||
| 1743 | + sharedinstall: $(DESTSHARED) all | ||
| 1772 | 1744 | @for i in X $(SHAREDMODS); do \ | |
| 1773 | 1745 | if test $$i != X; then \ | |
| 1774 | 1746 | echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \ | |
@@ -2252,17 +2224,6 @@ libainstall: all scripts | |||
| 2252 | 2224 | else true; \ | |
| 2253 | 2225 | fi | |
| 2254 | 2226 | ||
| 2255 | - # Install the dynamically loadable modules | ||
| 2256 | - # This goes into $(exec_prefix) | ||
| 2257 | - sharedinstall: all | ||
| 2258 | - $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ | ||
| 2259 | - --prefix=$(prefix) \ | ||
| 2260 | - --install-scripts=$(BINDIR) \ | ||
| 2261 | - --install-platlib=$(DESTSHARED) \ | ||
| 2262 | - --root=$(DESTDIR)/ | ||
| 2263 | - -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py | ||
| 2264 | - -rm -r $(DESTDIR)$(DESTSHARED)/__pycache__ | ||
| 2265 | - | ||
| 2266 | 2227 | # Here are a couple of targets for MacOSX again, to install a full | |
| 2267 | 2228 | # framework-based Python. frameworkinstall installs everything, the | |
| 2268 | 2229 | # subtargets install specific parts. Much of the actual work is offloaded to | |
@@ -2536,10 +2497,10 @@ update-config: | |||
| 2536 | 2497 | Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h | |
| 2537 | 2498 | ||
| 2538 | 2499 | # Declare targets that aren't real files | |
| 2539 | - .PHONY: all build_all build_wasm sharedmods check-clean-src | ||
| 2540 | - .PHONY: oldsharedmods checksharedmods test quicktest | ||
| 2541 | - .PHONY: install altinstall oldsharedinstall bininstall altbininstall | ||
| 2542 | - .PHONY: maninstall libinstall inclinstall libainstall sharedinstall | ||
| 2500 | + .PHONY: all build_all build_wasm check-clean-src | ||
| 2501 | + .PHONY: sharedmods checksharedmods test quicktest | ||
| 2502 | + .PHONY: install altinstall sharedinstall bininstall altbininstall | ||
| 2503 | + .PHONY: maninstall libinstall inclinstall libainstall | ||
| 2543 | 2504 | .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure | |
| 2544 | 2505 | .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools | |
| 2545 | 2506 | .PHONY: frameworkaltinstallunixtools recheck clean clobber distclean | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,2 @@ | |||
| 1 | + C extension modules are now built by ``configure`` and ``make`` | ||
| 2 | + instead of :mod:`distutils` and ``setup.py``. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -275,7 +275,7 @@ PYTHONPATH=$(COREPYTHONPATH) | |||
| 275 | 275 | #xx xxmodule.c | |
| 276 | 276 | #xxlimited xxlimited.c | |
| 277 | 277 | #xxlimited_35 xxlimited_35.c | |
| 278 | - xxsubtype xxsubtype.c # Required for the test suite to pass! | ||
| 278 | + #xxsubtype xxsubtype.c | ||
| 279 | 279 | ||
| 280 | 280 | # Testing | |
| 281 | 281 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -165,6 +165,7 @@ | |||
| 165 | 165 | ############################################################################ | |
| 166 | 166 | # Test modules | |
| 167 | 167 | ||
| 168 | + @MODULE_XXSUBTYPE_TRUE@xxsubtype xxsubtype.c | ||
| 168 | 169 | @MODULE__XXTESTFUZZ_TRUE@_xxtestfuzz _xxtestfuzz/_xxtestfuzz.c _xxtestfuzz/fuzzer.c | |
| 169 | 170 | @MODULE__TESTBUFFER_TRUE@_testbuffer _testbuffer.c | |
| 170 | 171 | @MODULE__TESTINTERNALCAPI_TRUE@_testinternalcapi _testinternalcapi.c | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -130,10 +130,11 @@ class ModuleChecker: | |||
| 130 | 130 | pybuilddir_txt = "pybuilddir.txt" | |
| 131 | 131 | ||
| 132 | 132 | setup_files = ( | |
| 133 | - SRC_DIR / "Modules/Setup", | ||
| 133 | + # see end of configure.ac | ||
| 134 | 134 | "Modules/Setup.local", | |
| 135 | - "Modules/Setup.bootstrap", | ||
| 136 | 135 | "Modules/Setup.stdlib", | |
| 136 | + "Modules/Setup.bootstrap", | ||
| 137 | + SRC_DIR / "Modules/Setup", | ||
| 137 | 138 | ) | |
| 138 | 139 | ||
| 139 | 140 | def __init__(self, cross_compiling: bool = False, strict: bool = False): | |
@@ -308,12 +309,6 @@ def get_sysconfig_modules(self) -> Iterable[ModuleInfo]: | |||
| 308 | 309 | MODBUILT_NAMES: modules in *static* block | |
| 309 | 310 | MODSHARED_NAMES: modules in *shared* block | |
| 310 | 311 | MODDISABLED_NAMES: modules in *disabled* block | |
| 311 | - | ||
| 312 | - Modules built by setup.py addext() have a MODULE_{modname}_STATE entry, | ||
| 313 | - but are not listed in MODSHARED_NAMES. | ||
| 314 | - | ||
| 315 | - Modules built by old-style setup.py add() have neither a MODULE_{modname} | ||
| 316 | - entry nor an entry in MODSHARED_NAMES. | ||
| 317 | 312 | """ | |
| 318 | 313 | moddisabled = set(sysconfig.get_config_var("MODDISABLED_NAMES").split()) | |
| 319 | 314 | if self.cross_compiling: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,6 @@ | |||
| 12 | 12 | ||
| 13 | 13 | SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) | |
| 14 | 14 | STDLIB_PATH = os.path.join(SRC_DIR, 'Lib') | |
| 15 | - SETUP_PY = os.path.join(SRC_DIR, 'setup.py') | ||
| 16 | 15 | ||
| 17 | 16 | IGNORE = { | |
| 18 | 17 | '__init__', | |
@@ -64,15 +63,6 @@ def list_packages(names): | |||
| 64 | 63 | names.add(name) | |
| 65 | 64 | ||
| 66 | 65 | ||
| 67 | - # Extension modules built by setup.py | ||
| 68 | - def list_setup_extensions(names): | ||
| 69 | - cmd = [sys.executable, SETUP_PY, "-q", "build", "--list-module-names"] | ||
| 70 | - output = subprocess.check_output(cmd) | ||
| 71 | - output = output.decode("utf8") | ||
| 72 | - extensions = output.splitlines() | ||
| 73 | - names |= set(extensions) | ||
| 74 | - | ||
| 75 | - | ||
| 76 | 66 | # Built-in and extension modules built by Modules/Setup* | |
| 77 | 67 | # includes Windows and macOS extensions. | |
| 78 | 68 | def list_modules_setup_extensions(names): | |
@@ -103,7 +93,6 @@ def list_frozen(names): | |||
| 103 | 93 | def list_modules(): | |
| 104 | 94 | names = set(sys.builtin_module_names) | |
| 105 | 95 | list_modules_setup_extensions(names) | |
| 106 | - list_setup_extensions(names) | ||
| 107 | 96 | list_packages(names) | |
| 108 | 97 | list_python_modules(names) | |
| 109 | 98 | list_frozen(names) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments