updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / wicd-ipv6 / deepcopy+python27-fixes.patch
blob51a2c8312dc35a7618d031bafb9d6ebd6f6f6d6a
1 diff -ur wicd-1.7.0/wicd/configmanager.py wicd-1.7.0.new/wicd/configmanager.py
2 --- wicd-1.7.0/wicd/configmanager.py 2010-01-15 05:49:11.000000000 +0100
3 +++ wicd-1.7.0.new/wicd/configmanager.py 2010-10-08 13:14:22.084345024 +0200
4 @@ -35,7 +35,7 @@
5 class ConfigManager(RawConfigParser):
6 """ A class that can be used to manage a given configuration file. """
7 def __init__(self, path, debug=False, mark_whitespace="`'`"):
8 - RawConfigParser.__init__(self)
9 + RawConfigParser.__init__(self, allow_no_value=True)
10 self.config_file = path
11 self.debug = debug
12 self.mrk_ws = mark_whitespace
13 @@ -176,28 +176,35 @@
16 def _copy_section(self, name):
17 - # Yes, deepcopy sucks, but it is robust to changes in both
18 - # this class and RawConfigParser.
19 - p = copy.deepcopy(self)
20 - for sname in p.sections():
21 - if sname != name:
22 - p.remove_section(sname)
23 + p = ConfigManager("", self.debug, self.mrk_ws)
24 + p.add_section(name)
25 + for (iname, value) in self.items(name):
26 + p.set(name, iname, value)
27 + # Store the filename this section was read from.
28 p.config_file = p.get_option(name, '_filename_', p.config_file)
29 p.remove_option(name, '_filename_')
30 return p
32 def write(self):
33 """ Writes the loaded config file to disk. """
34 - # Really don't like this deepcopy.
35 - p = copy.deepcopy(self)
36 - for sname in p.sections():
37 - fname = p.get_option(sname, '_filename_')
38 + in_this_file = []
39 + for sname in self.sections():
40 + fname = self.get_option(sname, '_filename_')
41 if fname and fname != self.config_file:
42 + # Write sections from other files
43 section = self._copy_section(sname)
44 - p.remove_section(sname)
45 section._write_one()
46 + else:
47 + # Save names of local sections
48 + in_this_file.append(sname)
50 - for sname in p.sections():
51 + # Make an instance with only these sections
52 + p = ConfigManager("", self.debug, self.mrk_ws)
53 + p.config_file = self.config_file
54 + for sname in in_this_file:
55 + p.add_section(sname)
56 + for (iname, value) in self.items(sname):
57 + p.set(sname, iname, value)
58 p.remove_option(sname, '_filename_')
59 p._write_one()
61 diff -ur wicd-1.7.0/wicd/wicd-daemon.py wicd-1.7.0.new/wicd/wicd-daemon.py
62 --- wicd-1.7.0/wicd/wicd-daemon.py 2010-01-15 05:49:11.000000000 +0100
63 +++ wicd-1.7.0.new/wicd/wicd-daemon.py 2010-10-08 13:11:15.811786603 +0200
64 @@ -1802,7 +1802,7 @@
65 wicd_bus = dbus.service.BusName('org.wicd.daemon', bus=bus)
66 daemon = WicdDaemon(wicd_bus, auto_connect=auto_connect)
67 if not no_poll:
68 - child_pid = Popen([misc.find_path("python"), "-O",
69 + child_pid = Popen([misc.find_path("python2"), "-O",
70 os.path.join(wpath.daemon, "monitor.py")],
71 shell=False, close_fds=True).pid
72 atexit.register(on_exit, child_pid)