File: python3.12.patch

package info (click to toggle)
oz 0.17.0-7
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,120 kB
  • sloc: python: 7,875; xml: 654; perl: 610; makefile: 49; sh: 29
file content (72 lines) | stat: -rw-r--r-- 3,250 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Description: Replace SafeConfigParser deprecated in Python3.12
Bug-Debian: https://bugs.debian.org/1061815
Author: Andreas Tille <tille@debian.org>
Last-Update: 2024-02-08

--- a/tests/factory/test_factory.py
+++ b/tests/factory/test_factory.py
@@ -87,8 +87,8 @@ def runtest(**kwargs):
     try:
         tdl = oz.TDL.TDL(tdlxml)
 
-        config = configparser.SafeConfigParser()
-        config.readfp(StringIO("[libvirt]\nuri=qemu:///session\nbridge_name=%s" % route))
+        config = configparser.ConfigParser()
+        config.read_file(StringIO("[libvirt]\nuri=qemu:///session\nbridge_name=%s" % route))
 
         if os.getenv('DEBUG') is not None:
             logging.basicConfig(level=logging.DEBUG, format="%(message)s")
--- a/tests/guest/test_guest.py
+++ b/tests/guest/test_guest.py
@@ -63,8 +63,8 @@ route = default_route()
 def setup_guest(xml, macaddress=None):
     tdl = oz.TDL.TDL(xml)
 
-    config = configparser.SafeConfigParser()
-    config.readfp(StringIO("[libvirt]\nuri=qemu:///session\nbridge_name=%s" % route))
+    config = configparser.ConfigParser()
+    config.read_file(StringIO("[libvirt]\nuri=qemu:///session\nbridge_name=%s" % route))
 
     guest = oz.GuestFactory.guest_factory(tdl, config, None, macaddress=macaddress)
     return guest
@@ -354,8 +354,8 @@ def test_init_guest():
 def test_init_guest_bad_arch():
     tdl = oz.TDL.TDL(tdlxml)
     tdl.arch = 'armhf'  # Done here to make sure the TDL class doesn't error
-    config = configparser.SafeConfigParser()
-    config.readfp(StringIO("[libvirt]\nuri=qemu:///session\nbridge_name=%s" % route))
+    config = configparser.ConfigParser()
+    config.read_file(StringIO("[libvirt]\nuri=qemu:///session\nbridge_name=%s" % route))
     with py.test.raises(Exception):
         oz.GuestFactory.guest_factory(tdl, config, None)
 
--- a/oz/RedHat.py
+++ b/oz/RedHat.py
@@ -503,8 +503,8 @@ echo -n "!$ADDR,%s!" > %s
         initrd paths out of it.
         """
         self.log.debug("Got treeinfo, parsing")
-        config = configparser.SafeConfigParser()
-        config.readfp(fp)
+        config = configparser.ConfigParser()
+        config.read_file(fp)
         section = "images-%s" % (self.tdl.arch)
         kernel = oz.ozutil.config_get_key(config, section, "kernel", None)
         initrd = oz.ozutil.config_get_key(config, section, "initrd", None)
--- a/oz/ozutil.py
+++ b/oz/ozutil.py
@@ -721,12 +721,12 @@ def parse_config(config_file):
     Function to parse the configuration file.  If the passed in config_file is
     None, then the default configuration file is used.
     """
-    config = configparser.SafeConfigParser()
+    config = configparser.ConfigParser()
     if config_file is not None:
         # If the config_file passed in is not None, then we want to try to read
         # that config file (after expanding it).  If that config file doesn't
         # exist, we want to throw an error (which is why we use readfp here).
-        config.readfp(open(os.path.expanduser(config_file)))
+        config.read_file(open(os.path.expanduser(config_file)))
     else:
         # The config file was not passed in, so we want to use one of the
         # defaults.  First we check to see if a ~/.oz/oz.cfg exists; if it does,