blob: 1d95247f52d28c3db25e1470c48f88040011eb41 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
--- setup.py.orig 2020-04-06 22:22:14 UTC
+++ setup.py
@@ -9,7 +9,8 @@ import glob
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.util
+import importlib.machinery
import io
import os
import shutil
@@ -27,6 +28,13 @@ if sys.platform == 'win32' and sys.version_info > (2,
# 2.6's distutils.msvc9compiler can raise an IOError when failing to
# 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"))
|