Skip to content

Commit

Permalink
We no longer need to monky-patch build.has_ext_modules.
Browse files Browse the repository at this point in the history
All the logic was to replace has_ext_modules with our own version, we our
version is the very same code as the distutils' one.  I'm not even sure
whether it was ever necessary, because distutils does not seem to have changed
since py3.7 at least.

So, I think that this is safe to remove, but I hope it's not a Chesterton's
fence.
  • Loading branch information
antocuni committed Aug 2, 2022
1 parent bf3b83a commit be42806
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions hpy/devel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"This most likely means that you are using a version which "
"is too old. Try installing setuptools>=60.2")
from distutils import log
from distutils.command.build import build
from distutils.errors import DistutilsError
import setuptools.command as cmd
import setuptools.command.build_ext
Expand Down Expand Up @@ -67,7 +66,6 @@ def fix_distribution(self, dist):
Used from both setup.py and hpy/test.
"""
dist.hpydevel = self
base_build = dist.cmdclass.get("build", build)
build_ext = dist.cmdclass.get("build_ext", cmd.build_ext.build_ext)

# check that the supplied build_ext inherits from setuptools
Expand All @@ -89,19 +87,10 @@ def dist_has_ext_modules(self):
return True
return False

def build_has_ext_modules(self):
return self.distribution.has_ext_modules()

# replace build_ext subcommand
dist.cmdclass['build_ext'] = build_ext_hpy

dist.__class__.has_ext_modules = dist_has_ext_modules
base_build.has_ext_modules = build_has_ext_modules
# setuptools / distutils store subcommands in .subcommands which
# is a list of tuples of (extension_name, extension_needs_to_run_func).
# The two lines below replace .subcommand entry for build_ext.
idx = [sub[0] for sub in base_build.sub_commands].index("build_ext")
base_build.sub_commands[idx] = ("build_ext", build_has_ext_modules)

@monkeypatch(setuptools.command.bdist_egg)
def write_stub(resource, pyfile):
Expand Down

0 comments on commit be42806

Please sign in to comment.