File: do-not-use-imp-module.patch

package info (click to toggle)
xmds2 3.1.0%2Bdfsg2-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 42,616 kB
  • sloc: python: 64,051; cpp: 4,868; ansic: 1,463; makefile: 144; sh: 54; javascript: 8
file content (31 lines) | stat: -rw-r--r-- 1,058 bytes parent folder | download | duplicates (2)
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
Description: Do not use the deprecated imp module
 The imp module is deprecated in Python 3.11 and has been removed from
 Python 3.12. the call to imp.new_module has been replaced by
 types.ModuleType, which seems to have the same effect.
 .
 This patch works for both versions 3.11 and 3.12 of Python.
Author: Rafael Laboissière <rafael@debian.org>
Forwarded: https://sourceforge.net/p/xmds/mailman/message/58731003/
Applied-Upstream: https://sourceforge.net/p/xmds/code/3132/
Last-Update: 2024-01-30

--- xmds2-3.1.0+dfsg2.orig/xpdeint/waf/waflib/Context.py
+++ xmds2-3.1.0+dfsg2/xpdeint/waf/waflib/Context.py
@@ -6,7 +6,7 @@
 Classes and functions enabling the command system
 """
 
-import os, re, imp, sys
+import os, re, types, sys
 from waflib import Utils, Errors, Logs
 import waflib.Node
 
@@ -660,7 +660,7 @@ def load_module(path, encoding=None):
 	except KeyError:
 		pass
 
-	module = imp.new_module(WSCRIPT_FILE)
+	module = types.ModuleType(WSCRIPT_FILE)
 	try:
 		code = Utils.readf(path, m='r', encoding=encoding)
 	except EnvironmentError: