Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Backports:SLE-15-SP4:FactoryCandidates
python-http-parser
remove-imp-module.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File remove-imp-module.patch of Package python-http-parser
From 4d4984ce129253f9de475bfd3c683301c916e8b1 Mon Sep 17 00:00:00 2001 From: Steve Kowalik <steven@wedontsleep.org> Date: Thu, 11 Jan 2024 14:14:07 +1100 Subject: [PATCH] Switch to importlib in setup.py The imp module has been deprecated and was removed in Python 3.12. Switch to using importlib functions to load the module, rather than imp.load_source(). Fixes #99 --- setup.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5c3f768..04de1d0 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,8 @@ 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 @@ # 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"))
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor