Re: [PATCH] Fixed the problem with string to list properties (#560262)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ack.

On 02/02/2010 10:20 AM, Martin Gracik wrote:
Some udev properties which should be a string were
wrongly converted to a list of words.
---
  baseudev.py |    1 -
  pyudev.py   |   34 +++++++++++++++++-----------------
  2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/baseudev.py b/baseudev.py
index cef6766..3d9ee45 100644
--- a/baseudev.py
+++ b/baseudev.py
@@ -45,7 +45,6 @@ def udev_get_device(sysfs_path):

      if dev:
          dev["name"] = dev.sysname
-        dev["symlinks"] = dev.get("DEVLINKS", [])
          dev["sysfs_path"] = sysfs_path

          # now add in the contents of the uevent file since they're handy
diff --git a/pyudev.py b/pyudev.py
index 1b9b606..6ab5d30 100644
--- a/pyudev.py
+++ b/pyudev.py
@@ -105,6 +105,10 @@ libudev_udev_enumerate_get_list_entry = libudev.udev_enumerate_get_list_entry
  libudev_udev_enumerate_get_list_entry.restype = c_void_p
  libudev_udev_enumerate_get_list_entry.argtypes = [ c_void_p ]

+libudev_udev_device_get_devlinks_list_entry = libudev.udev_device_get_devlinks_list_entry
+libudev_udev_device_get_devlinks_list_entry.restype = c_void_p
+libudev_udev_device_get_devlinks_list_entry.argtypes = [ c_void_p ]
+

  class UdevDevice(dict):

@@ -121,6 +125,19 @@ class UdevDevice(dict):
          self.syspath = libudev_udev_device_get_syspath(udev_device)
          self.sysname = libudev_udev_device_get_sysname(udev_device)

+        # get the devlinks list
+        devlinks = []
+        devlinks_entry = libudev_udev_device_get_devlinks_list_entry(udev_device)
+
+        while devlinks_entry:
+            path = libudev_udev_list_entry_get_name(devlinks_entry)
+            devlinks.append(path)
+
+            devlinks_entry = libudev_udev_list_entry_get_next(devlinks_entry)
+
+        # add devlinks list to the dictionary
+        self["symlinks"] = devlinks
+
          # get the first property entry
          property_entry = libudev_udev_device_get_properties_list_entry(udev_device)

@@ -128,23 +145,6 @@ class UdevDevice(dict):
              name = libudev_udev_list_entry_get_name(property_entry)
              value = libudev_udev_list_entry_get_value(property_entry)

-            # XXX we have to split some of the values into a list,
-            # the libudev is not so smart :(
-            fields = value.split()
-
-            if len(fields)>  1:
-                value = [fields[0]]
-
-                for item in fields[1:]:
-                    (key, sep, val) = item.partition("=")
-                    if sep:
-                        value.append(val)
-                    else:
-                        value.append(key)
-
-                if len(value) == 1:
-                    value = value[0]
-
              self[name] = value

              # get next property entry

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux