python-pathtools/stop-using-imp.patch

25 lines
724 B
Diff

Index: pathtools-0.1.2/setup.py
===================================================================
--- pathtools-0.1.2.orig/setup.py
+++ pathtools-0.1.2/setup.py
@@ -22,12 +22,16 @@
# THE SOFTWARE.
import os
-import imp
+import importlib.machinery
+import importlib.util
from setuptools import setup
PKG_DIR = 'pathtools'
-version = imp.load_source('version',
- os.path.join(PKG_DIR, 'version.py'))
+path = os.path.join(PKG_DIR, 'version.py')
+loader = importlib.machinery.SourceFileLoader("pathtools", path)
+spec = importlib.util.spec_from_file_location("pathtools", path)
+version = importlib.util.module_from_spec(spec)
+loader.exec_module(version)
def read_file(filename):
"""