diff --git a/pkgs/development/python-modules/http-parser/default.nix b/pkgs/development/python-modules/http-parser/default.nix index 2ffc08beb200..7e53465939f2 100644 --- a/pkgs/development/python-modules/http-parser/default.nix +++ b/pkgs/development/python-modules/http-parser/default.nix @@ -5,6 +5,7 @@ cython, setuptools, pytestCheckHook, + fetchpatch, }: buildPythonPackage rec { @@ -34,7 +35,12 @@ buildPythonPackage rec { # The imp module is deprecated since version 3.4, and was removed in 3.12 # https://docs.python.org/3.11/library/imp.html # Fix from: https://github.com/benoitc/http-parser/pull/101/ - patches = [ ./imp-importlib.diff ]; + patches = [ + (fetchpatch { + url = "https://github.com/benoitc/http-parser/commit/4d4984ce129253f9de475bfd3c683301c916e8b1.patch"; + hash = "sha256-d3k1X41/D9PpPWsDety2AiYyLv9LJIhpkOo3a6qKcB8="; + }) + ]; nativeCheckInputs = [ pytestCheckHook ]; diff --git a/pkgs/development/python-modules/http-parser/imp-importlib.diff b/pkgs/development/python-modules/http-parser/imp-importlib.diff deleted file mode 100644 index e8b166a9c099..000000000000 --- a/pkgs/development/python-modules/http-parser/imp-importlib.diff +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/setup.py b/setup.py -index 5c3f768..04de1d0 100644 ---- a/setup.py -+++ b/setup.py -@@ -9,7 +9,8 @@ from distutils.errors import CCompilerError, DistutilsExecError, \ - from distutils.command.build_ext import build_ext - from distutils.command.sdist import sdist as _sdist - import glob --from imp import load_source -+import importlib.machinery -+import importlib.util - import io - import os - import shutil -@@ -28,6 +29,16 @@ if sys.platform == 'win32' and sys.version_info > (2, 6): - # find the compiler - ext_errors += (IOError,) - -+ -+def load_source(modname, filename): -+ loader = importlib.machinery.SourceFileLoader(modname, filename) -+ spec = importlib.util.spec_from_file_location( -+ modname, filename, loader=loader) -+ module = importlib.util.module_from_spec(spec) -+ loader.exec_module(module) -+ return module -+ -+ - http_parser = load_source("http_parser", os.path.join("http_parser", - "__init__.py")) -