Description: Do not attempt to build vendored pydevd package
 setup.py attempts to build the Cython extensions included in pydevd; since
 we will copy the existing pydevd instead, we remove all references to
 compiling pydevd from setup.py.
Forwarded: not-needed
Author: Julian Gilbey <jdg@debian.org>
Last-Update: 2025-02-25

--- a/setup.py
+++ b/setup.py
@@ -33,22 +33,6 @@
     return None
 
 
-# bdist_wheel determines whether the package is pure or not based on ext_modules.
-# However, all pydevd native modules are prebuilt and packaged as data, so they
-# should not be in the list.
-#
-# The proper way to handle this is by overriding has_ext_modules. However, due to
-# https://bugs.python.org/issue32957, in setuptools 57.0.0 and below, it is not
-# always called when it should be, with ext_modules tested directly instead.
-#
-# So, for non-pure builds, we provide a customized empty list for ext_modules that
-# tests as truthful - this causes the package to be treated as non-pure on all
-# relevant setuptools versions.
-class ExtModules(list):
-    def __bool__(self):
-        return True
-
-
 def override_build(cmds):
     def finalize_options(self):
         # Mark all packages as pure if requested to build a universal wheel.
@@ -62,7 +46,7 @@
     try:
         build = cmds["build"]
     except KeyError:
-        from distutils.command.build import build
+        from setuptools.command.build import build
     original = build.finalize_options
     build.finalize_options = finalize_options
 
@@ -73,32 +57,6 @@
     def finalize_options(self):
         original(self)
 
-        # Ensure that pydevd extensions are present for inclusion into data_files.
-        self.announce(
-            "Compiling pydevd Cython extension modules (set SKIP_CYTHON_BUILD=1 to omit)."
-        )
-        try:
-            subprocess.check_call(
-                [
-                    sys.executable,
-                    os.path.join(PYDEVD_ROOT, "setup_pydevd_cython.py"),
-                    "build_ext",
-                    "--inplace",
-                ]
-            )
-        except subprocess.SubprocessError:
-            # pydevd Cython extensions are optional performance enhancements, and debugpy is
-            # usable without them. Thus, we want to ignore build errors here by default, so
-            # that a user can do `pip install debugpy` on a platform for which we don't supply
-            # prebuild wheels even if they don't have the C build tools installed. On the other
-            # hand, for our own official builds and for local development, we want to know if
-            # the extensions fail to build.
-            if int(os.getenv("REQUIRE_CYTHON_BUILD", "0")):
-                raise
-            self.warn(
-                "Failed to compile pydevd Cython extension modules (set SKIP_CYTHON_BUILD=1 to omit); proceeding without them."
-            )
-
         # Register pydevd and other vendored packages as package data for debugpy.
         vendored_files = self.package_data["debugpy._vendored"]
         for project in debugpy._vendored.list_all():
@@ -192,8 +150,7 @@
                 # so it is populated in the overridden build_py.finalize_options().
             ],
         },
-        ext_modules=ExtModules(),
-        has_ext_modules=lambda: True,
+        has_ext_modules=lambda: False,
         cmdclass=cmds,
         # allow the user to call "debugpy" instead of "python -m debugpy"
         entry_points={"console_scripts": ["debugpy = debugpy.server.cli:main"]},
