File: no_imp_modules.patch

package info (click to toggle)
geophar 18.10%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 11,752 kB
  • sloc: python: 41,808; javascript: 2,600; makefile: 119; xml: 97; sh: 53
file content (44 lines) | stat: -rw-r--r-- 1,667 bytes parent folder | download
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Index: geophar/wxgeometrie/dependances.py
===================================================================
--- geophar.orig/wxgeometrie/dependances.py
+++ geophar/wxgeometrie/dependances.py
@@ -22,7 +22,7 @@
 # Ce module sert à tester que toutes les dépendances sont satisfaites,
 # et à y remédier dans le cas contraire (si possible).
 
-import sys, imp, platform, os, shutil, subprocess
+import sys, importlib, platform, os, shutil, subprocess
 
 # ------------------------------------------------------------------------------
 # CONFIGURATION
@@ -92,15 +92,8 @@ def tester_dependances():
     for module in dependances:
         module_name = module
         try:
-            # imp.find_module() doesn't support submodules.
-            path = None
-            while '.' in module:
-                module, submodule = module.split('.', 1)
-                f, filename, description = imp.find_module(module, path)
-                module = submodule
-                path = [filename]
-            imp.find_module(module, path)
-        except ImportError:
+            importlib.import_module(module)
+        except ModuleNotFoundError:
             modules_manquants.append(module_name)
 
 
Index: geophar/wxgeometrie/initialisation.py
===================================================================
--- geophar.orig/wxgeometrie/initialisation.py
+++ geophar/wxgeometrie/initialisation.py
@@ -20,7 +20,7 @@
 
 import time
 t0 = time.time()
-import sys, os, itertools, traceback, imp, subprocess
+import sys, os, itertools, traceback, subprocess
 from os.path import dirname, realpath, normpath
 
 # Emplacement du module python nommé wxgeometrie