[Python-modules-commits] [pyudev] 02/10: Import pyudev_0.21.0.orig.tar.gz

Felix Geyer fgeyer at moszumanska.debian.org
Fri Sep 9 21:44:44 UTC 2016


This is an automated email from the git hooks/post-receive script.

fgeyer pushed a commit to branch master
in repository pyudev.

commit ae5c381863dec12ad8f7df18f337dd8b06eaf6a2
Author: Felix Geyer <fgeyer at debian.org>
Date:   Fri Sep 9 22:22:07 2016 +0200

    Import pyudev_0.21.0.orig.tar.gz
---
 CHANGES.rst                                 |  26 +-
 MANIFEST.in                                 |   1 +
 PKG-INFO                                    |   4 +-
 README.rst                                  |   2 +-
 doc/guide.rst                               |  13 +-
 doc/tests/running.rst                       |  21 -
 reproducers/1255191.c                       |  32 --
 reproducers/1263351.c                       |  47 ---
 reproducers/1263351a.c                      |  48 ---
 reproducers/1265315.c                       |  62 ---
 reproducers/1265315.py                      |  45 --
 reproducers/1297512.c                       |  51 ---
 reproducers/1297512.py                      |  34 --
 reproducers/1302359.c                       |  54 ---
 src/pyudev.egg-info/PKG-INFO                |   4 +-
 src/pyudev.egg-info/SOURCES.txt             |  18 +-
 src/pyudev/__init__.py                      |  34 +-
 src/pyudev/_ctypeslib/_errorcheckers.py     |   6 +-
 src/pyudev/_ctypeslib/libc.py               |  33 +-
 src/pyudev/_ctypeslib/libudev.py            | 395 +++++++++---------
 src/pyudev/_ctypeslib/{libc.py => utils.py} |  53 ++-
 src/pyudev/_os/pipe.py                      |   6 +-
 src/pyudev/_parsing/__init__.py             |  39 --
 src/pyudev/_parsing/_devlink.py             | 101 -----
 src/pyudev/_parsing/_id_path.py             | 171 --------
 src/pyudev/_parsing/_pci_address.py         |  60 ---
 src/pyudev/_parsing/_shared.py              | 118 ------
 src/pyudev/_qt_base.py                      |   4 +-
 src/pyudev/_util.py                         |  17 +-
 src/pyudev/core.py                          |  18 +-
 src/pyudev/device/__init__.py               |  12 -
 src/pyudev/device/_device.py                | 164 +++++++-
 src/pyudev/discover.py                      |  19 +-
 src/pyudev/glib.py                          |   6 +-
 src/pyudev/monitor.py                       |  10 +-
 src/pyudev/version.py                       |   2 +-
 tests/_constants.py                         |  77 +++-
 tests/_device_tests/_attributes_tests.py    |  45 +-
 tests/_device_tests/_device_tests.py        |  86 ++--
 tests/_device_tests/_devices_tests.py       |   2 +-
 tests/_device_tests/_tags_tests.py          |  25 +-
 tests/conftest.py                           |   2 -
 tests/plugins/fake_monitor.py               |   1 -
 tests/test_core.py                          |   1 -
 tests/test_discover.py                      |   4 +-
 tests/test_enumerate.py                     | 609 +++++++++++++++++++---------
 tests/test_libudev.py                       | 172 --------
 tests/test_monitor.py                       |   9 +-
 tests/test_observer.py                      |  11 +-
 tests/test_observer_deprecated.py           |   6 +-
 tests/test_parsing.py                       | 143 -------
 tests/test_pypi.py                          |   4 +-
 tests/test_util.py                          |  16 +-
 tests/utils/__init__.py                     |   2 +-
 tests/utils/journal.py                      |  55 ---
 tests/utils/libudev.py                      | 186 ---------
 tests/utils/misc.py                         |  31 ++
 tests/utils/udev.py                         | 101 ++---
 tox.ini                                     |   4 +-
 59 files changed, 1158 insertions(+), 2164 deletions(-)

diff --git a/CHANGES.rst b/CHANGES.rst
index 9ad2449..4b6077c 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,4 +1,28 @@
-0.19.0 (Feb 3, 2015)
+0.21.0 (July 20, 2016)
+======================
+
+- Deprecate use of Device object as mapping from udev property names to values.
+- Add a Properties class and a Device.properties() method for udev properties.
+- Fix places where Device object was incorrectly used in a boolean context.
+- Return an empty string, not None, if the property value is an empty string.
+- Exceptions re-raised from libudev calls now have a message string.
+- Insert a warning about using a Device in a boolean context in docs.
+- Infrastructure for vagrant tests is removed.
+- Various internal refactorings.
+- Extensive test improvements.
+- Numerous documentation fixes.
+
+0.20.0 (April 29, 2016)
+=======================
+
+- Remove parsing code added in previous release.
+- No longer do CI for Python 2.6.
+- Eliminate all wildcard imports and __all__ statements.
+- No longer use deprecated Device.from_sys_path() method.
+- Minor pylint induced changes.
+- Documentation fixes.
+
+0.19.0 (Feb 3, 2016)
 ==================
 
 - Restore raising KeyError by Attributes.as* methods when attribute not found.
diff --git a/MANIFEST.in b/MANIFEST.in
index 89a8c74..11ed5ef 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,6 +1,7 @@
 recursive-include src/pyudev *.py
 recursive-include doc *.rst *.py *.html
 recursive-include tests *.py
+recursive-exclude tests/.hypothesis *.py
 recursive-include reproducers *.c *.py
 include tox.ini
 global-include requirements.txt
diff --git a/PKG-INFO b/PKG-INFO
index a86ba26..5938e98 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pyudev
-Version: 0.19.0
+Version: 0.21.0
 Summary: A libudev binding
 Home-page: http://pyudev.readthedocs.org/
 Author: Sebastian Wiesner
@@ -63,7 +63,7 @@ Description: ######
         
         The source code is hosted on GitHub_::
         
-           git clone git://github.com/lunaryorn/pyudev.git
+           git clone git://github.com/pyudev/pyudev.git
         
         Please fork the repository and send pull requests with your fixes or new
         features, but respect the following guidelines:
diff --git a/README.rst b/README.rst
index b96e3bc..d4c2322 100644
--- a/README.rst
+++ b/README.rst
@@ -55,7 +55,7 @@ Development
 
 The source code is hosted on GitHub_::
 
-   git clone git://github.com/lunaryorn/pyudev.git
+   git clone git://github.com/pyudev/pyudev.git
 
 Please fork the repository and send pull requests with your fixes or new
 features, but respect the following guidelines:
diff --git a/doc/guide.rst b/doc/guide.rst
index f81468e..dfeb332 100644
--- a/doc/guide.rst
+++ b/doc/guide.rst
@@ -8,7 +8,7 @@ like device enumeration or monitoring:
 
 .. contents::
 
-A detailled reference is provided in the :doc:`API documentation <api/index>`.
+A detailed reference is provided in the :doc:`API documentation <api/index>`.
 
 
 Getting started
@@ -245,7 +245,7 @@ filesystems:
 >>> monitor.filter_by('block')
 >>> for device in iter(monitor.poll, None):
 ...     if 'ID_FS_TYPE' in device:
-...         print('{0} partition {1}'.format(action, device.get('ID_FS_LABEL')))
+...         print('{0} partition {1}'.format(device.action, device.get('ID_FS_LABEL')))
 ...
 add partition MULTIBOOT
 remove partition MULTIBOOT
@@ -342,6 +342,15 @@ For instance, the above example would look like this in a PySide_ application:
 >>> observer.deviceEvent.connect(log_event)
 >>> monitor.start()
 
+Device objects as booleans
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+The use of a Device object in a boolean context as a shorthand for a comparison
+with None is an error.
+
+The Device class inherits from the abstract Mapping class, as it maps udev
+property names to their values. Consequently, if a Device object has no udev
+properties, an unusual but not impossible occurance, the object is
+interpreted as False in a boolean context.
 
 .. _pypi: https://pypi.python.org/pypi/pyudev
 .. _libudev: http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/
diff --git a/doc/tests/running.rst b/doc/tests/running.rst
index b180d65..e31e6fd 100644
--- a/doc/tests/running.rst
+++ b/doc/tests/running.rst
@@ -1,22 +1,6 @@
 Test running
 ============
 
-Virtual testing
----------------
-
-If you are on a non-Linux system install VirtualBox_ and Vagrant_, and run
-``make vagrant-test``.
-
-You may specify arbitrary :program:`py.test` arguments by ``TESTARGS``::
-
-   make TESTARGS='--enable-privileged -k observer --verbose' vagrant-test
-
-Vagrant automatically fetches, installs and provisions a virtual machine based
-on Ubuntu Lucid.  This virtual machine has the pyudev source code linked in as
-shared folder under ``/vagrant``, and two virtualenvs for Python 2 and Python 3
-with all dependencies installed at ``~/pyudev-py2`` and ``~/pyudev-py3``
-respectively.  Use ``vagrant ssh`` to get a shell on this machine.
-
 
 Direct testing using tox_
 -------------------------
@@ -55,8 +39,3 @@ Some tests need to execute privileged operations like loading or unloading of
 kernel modules to trigger real udev events.  These tests are disabled by
 default.  Refer to :mod:`~tests.plugins.privileged` for more information on how
 to enable these tests and configure them properly.
-
-.. _virtualbox: https://www.virtualbox.org/
-.. _vagrant: http://vagrantup.com/
-.. _virtualenv: http://www.virtualenv.org/en/latest/index.html
-.. _tox: http://tox.testrun.org/latest/
diff --git a/reproducers/1255191.c b/reproducers/1255191.c
deleted file mode 100644
index 6297983..0000000
--- a/reproducers/1255191.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdio.h>
-#include <libudev.h>
-
-int main() {
-    int res;
-    struct udev * context;
-    struct udev_enumerate * enumerator;
-    struct udev_device * device;
-    struct udev_list_entry * entry;
-    char const * name;
-    context = udev_new();
-    enumerator = udev_enumerate_new(context);
-    device = udev_device_new_from_syspath(context, "/sys/devices/system/memory");
-    res = udev_enumerate_add_match_parent(enumerator, device);
-    if (res < 0) {
-        return res;
-    }
-
-    res = udev_enumerate_scan_devices(enumerator);
-    if (res < 0) {
-        return res;
-    }
-
-    entry = udev_enumerate_get_list_entry(enumerator);
-    while (entry) {
-        name = udev_list_entry_get_name(entry);
-        printf("%s\n", name);
-        entry = udev_list_entry_get_next(entry);
-    }
-
-    return 0;
-}
diff --git a/reproducers/1263351.c b/reproducers/1263351.c
deleted file mode 100644
index 4435de2..0000000
--- a/reproducers/1263351.c
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <stdio.h>
-#include <libudev.h>
-
-int main() {
-    int res;
-    struct udev * context;
-    struct udev_enumerate * enumerator;
-    struct udev_device * device;
-    struct udev_list_entry * entry;
-    char const * name;
-    context = udev_new();
-
-    /* correct, uses the actual name of the device, always works */
-    device = udev_device_new_from_subsystem_sysname(
-       context,
-       "block",
-       "sdaj"
-    );
-    if (device == NULL) {
-        return 3;
-    }
-
-    /* sort of correct, uses the name with the subsystem prefix stripped,
-      but works in that case.
-    */
-    device = udev_device_new_from_subsystem_sysname(
-       context,
-       "input",
-       "event0" /* fails on name as reported by udevadm, "input/event0" */
-    );
-    if (device == NULL) {
-        return 2;
-    }
-
-    /* fails no matter what, probably because name reported by mdadm does not
-       contain a prefix identical to the subsystem string. */
-    device = udev_device_new_from_subsystem_sysname(
-       context,
-       "iLO",
-       "hpilo/d0ccb10"
-    );
-    if (device == NULL) {
-        return 1;
-    }
-
-    return 0;
-}
diff --git a/reproducers/1263351a.c b/reproducers/1263351a.c
deleted file mode 100644
index b1cab33..0000000
--- a/reproducers/1263351a.c
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <stdio.h>
-#include <libudev.h>
-
-int main() {
-    int res;
-    struct udev * context;
-    struct udev_enumerate * enumerator;
-    struct udev_device * device;
-    struct udev_device * new_device;
-    struct udev_list_entry * entry;
-    char const * sys_name;
-    char const * subsystem;
-    context = udev_new();
-
-    device = udev_device_new_from_syspath(
-       context,
-       /* comment the line below and uncomment the one below that, it works. */
-       "/sys/devices/pci0000:00/0000:00:1c.2/0000:01:00.2/iLO/hpilo!d0ccb0"
-       /* "/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input0/event0" */
-    );
-    if (device == NULL) {
-        return 1;
-    }
-
-    sys_name = udev_device_get_sysname(device);
-    if (sys_name == NULL) {
-        return 2;
-    }
-    printf("%s\n", sys_name);
-
-    subsystem = udev_device_get_subsystem(device);
-    if (subsystem == NULL) {
-        return 3;
-    }
-    printf("%s\n", subsystem);
-
-    new_device = udev_device_new_from_subsystem_sysname(
-       context,
-       subsystem,
-       sys_name
-    );
-
-    if (new_device == NULL) {
-        return 4;
-    }
-
-    return 0;
-}
diff --git a/reproducers/1265315.c b/reproducers/1265315.c
deleted file mode 100644
index 1f44197..0000000
--- a/reproducers/1265315.c
+++ /dev/null
@@ -1,62 +0,0 @@
-#include <stdio.h>
-#include <libudev.h>
-
-int main() {
-    int res;
-    struct udev * context;
-    struct udev_enumerate * enumerator;
-    struct udev_device * device;
-    struct udev_list_entry * entry;
-    struct udev_list_entry * other_entry;
-    struct udev_list_entry * start;
-    char const * name;
-    char const * value;
-    context = udev_new();
-
-    device = udev_device_new_from_syspath(
-       context,
-       "/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:26/device:27"
-    );
-
-    printf("udev_list_entry_get_value()\n");
-    printf("Correct behavior, values are not obtained.\n");
-    entry = udev_device_get_sysattr_list_entry(device);
-    while (entry) {
-        name = udev_list_entry_get_name(entry);
-        value = udev_list_entry_get_value(entry);
-        printf("%s: %s\n", name, value);
-        entry = udev_list_entry_get_next(entry);
-    }
-    printf("\n");
-
-    printf("udev_device_get_sysattr_value()\n");
-    printf("Incorrect behavior; physical_node should have a value.\n");
-    entry = udev_device_get_sysattr_list_entry(device);
-    while (entry) {
-        name = udev_list_entry_get_name(entry);
-        value = udev_device_get_sysattr_value(device, name);
-        printf("%s: %s\n", name, value);
-        entry = udev_list_entry_get_next(entry);
-    }
-    printf("\n");
-
-    printf("udev_device_get_sysattr_value(bogus)\n");
-    printf("correct behavior, value of non-existant attribute is null.\n");
-    value = udev_device_get_sysattr_value(device, "bogus");
-    printf("bogus: %s\n", value);
-    printf("\n");
-
-    printf("Should be like the first.\n");
-    entry = udev_device_get_sysattr_list_entry(device);
-    start = entry;
-    while (entry) {
-        name = udev_list_entry_get_name(entry);
-        other_entry = udev_list_entry_get_by_name(start, name);
-        value = udev_list_entry_get_value(other_entry);
-        printf("%s: %s\n", name, value);
-        entry = udev_list_entry_get_next(entry);
-    }
-    printf("\n");
-
-    return 0;
-}
diff --git a/reproducers/1265315.py b/reproducers/1265315.py
deleted file mode 100644
index 83adfbe..0000000
--- a/reproducers/1265315.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# pylint: disable=invalid-name
-
-"""
-Report to generate examples for bz#1265315.
-"""
-
-from __future__ import print_function
-
-import os
-import stat
-
-import pyudev
-
-def main():
-    """
-    Print all devices which have available attributes w/ no value.
-
-    Print all instance of such attributes which are not symlinked directories.
-
-    If any of the not symlinked directories set are readable by the owner
-    (presumably root), print those.
-    """
-    context = pyudev.Context()
-    for device in context.list_devices():
-        attributes = device.attributes
-        attrs = [a for a in attributes if not a in attributes]
-        if attrs:
-            print("%s: %s" % (device, ", ".join(attrs)))
-            path = device.sys_path
-            pairs = ((attr, os.path.join(path, attr)) for attr in attrs)
-            expected = lambda f: os.path.islink(f) and os.path.isdir(f)
-            surprises = [(a, f) for (a, f) in pairs if not expected(f)]
-            if surprises:
-                fmt_str = "SURPRISE (not symlinked directories): %s"
-                print(fmt_str % ", ".join(a for (a, f) in surprises))
-
-                readable = lambda f: os.stat(f).st_mode & stat.S_IRUSR
-                readables = [(a, f) for (a, f) in surprises if readable(f)]
-
-                if readables:
-                    fmt_str = "a subset were readable: %s"
-                    print(fmt_str % ", ".join(a for (a, f) in readables))
-
-if __name__ == "__main__":
-    main()
diff --git a/reproducers/1297512.c b/reproducers/1297512.c
deleted file mode 100644
index 97b6d49..0000000
--- a/reproducers/1297512.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <libudev.h>
-
-int main() {
-    int res;
-    struct udev * context;
-    struct udev_device * device;
-    struct udev_enumerate * enumerator;
-    struct udev_list_entry * entry;
-    char const * name;
-    char const * dev_name;
-
-    context = udev_new();
-    // If the device with a subsystem is used, exit is 2.
-    // If the device without a subsystem is used, exit is 0.
-
-    // This device has a subsystem. It is a very standard block device.
-    device = udev_device_new_from_syspath(context, "/sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda");
-    // This device has no subsystem. It is an ancestor of above device.
-    device = udev_device_new_from_syspath(context, "/sys/devices/pci0000:00/0000:00:1f.2/ata1");
-    if (device == NULL) {
-        return -1;
-    }
-
-    // The device has a perfectly valid syspath.
-    dev_name = udev_device_get_syspath(device);
-    if (dev_name == NULL) {
-        return -1;
-    }
-
-    enumerator = udev_enumerate_new(context);
-    res = udev_enumerate_scan_devices(enumerator);
-    if (res < 0) {
-        return res;
-    }
-
-    // returns 2 if the device is among the list of devices
-    entry = udev_enumerate_get_list_entry(enumerator);
-    while (entry) {
-        name = udev_list_entry_get_name(entry);
-        if (strcmp(dev_name, name) == 0) {
-            return 2;
-        }
-        entry = udev_list_entry_get_next(entry);
-    }
-
-    // otherwise, returns 0
-    return 0;
-}
diff --git a/reproducers/1297512.py b/reproducers/1297512.py
deleted file mode 100644
index d3092e9..0000000
--- a/reproducers/1297512.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# pylint: disable=invalid-name
-
-"""
-Report to generate examples for bz#1265315.
-"""
-
-from __future__ import print_function
-
-import pyudev
-
-def main():
-    """
-    Find a device which exists but which is not among devices listed.
-    """
-    context = pyudev.Context()
-    device = pyudev.Device.from_name(context, 'block', 'sda1')
-    no_subsys_dev = None
-    for dev in device.ancestors:
-        try:
-            dev.subsystem
-        except AttributeError:
-            no_subsys_dev = dev
-            break
-
-    import pdb
-    pdb.set_trace()
-    devices = context.list_devices()
-
-    if no_subsys_dev not in devices:
-        return 0
-    return 1
-
-if __name__ == "__main__":
-    main()
diff --git a/reproducers/1302359.c b/reproducers/1302359.c
deleted file mode 100644
index c66f13c..0000000
--- a/reproducers/1302359.c
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <libudev.h>
-
-int main() {
-    int res;
-    struct udev * context;
-    struct udev_device * device;
-    struct udev_enumerate * enumerator;
-    struct udev_list_entry * entry;
-    char const * name;
-    char const * dev_name;
-    char const * attr;
-
-    context = udev_new();
-    // If the device with a subsystem is used, exit is 2.
-    // If the device without a subsystem is used, exit is 0.
-
-    // This device has a vpd_pg83 file with some binary contents.
-    // But libudev does not report the contents.
-    device = udev_device_new_from_syspath(context, "/sys/devices/pci0000:00/0000:00:03.0/0000:03:00.0/host1/target1:0:0/1:0:0:0");
-    if (device == NULL) {
-        return -1;
-    }
-
-    attr = udev_device_get_sysattr_value(device, "vpd_pg83");
-    if (attr == NULL) {
-        return -1; // no attribute file found
-    }
-
-    if (strlen(attr) > 0) {
-        return -1; // suprise! this one has a non empty value this time
-    }
-
-    // This device seems just the same, i.e, it has a vpd_pg83 file with some binary contents.
-    // But in this case, libudev reports a non-empty value.
-    device = udev_device_new_from_syspath(context, "/sys/devices/pci0000:80/0000:80:02.0/0000:81:00.0/host2/target2:0:9/2:0:9:0");
-    if (device == NULL) {
-        return -1;
-    }
-
-    attr = udev_device_get_sysattr_value(device, "vpd_pg83");
-    if (attr == NULL) {
-        return -1; // no attribute file found
-    }
-
-    if (strlen(attr) == 0) {
-        return -1; // suprise! this one has an empty value this time
-    }
-
-    // otherwise, returns 0
-    return 0;
-}
diff --git a/src/pyudev.egg-info/PKG-INFO b/src/pyudev.egg-info/PKG-INFO
index a86ba26..5938e98 100644
--- a/src/pyudev.egg-info/PKG-INFO
+++ b/src/pyudev.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pyudev
-Version: 0.19.0
+Version: 0.21.0
 Summary: A libudev binding
 Home-page: http://pyudev.readthedocs.org/
 Author: Sebastian Wiesner
@@ -63,7 +63,7 @@ Description: ######
         
         The source code is hosted on GitHub_::
         
-           git clone git://github.com/lunaryorn/pyudev.git
+           git clone git://github.com/pyudev/pyudev.git
         
         Please fork the repository and send pull requests with your fixes or new
         features, but respect the following guidelines:
diff --git a/src/pyudev.egg-info/SOURCES.txt b/src/pyudev.egg-info/SOURCES.txt
index 7667862..898d67a 100644
--- a/src/pyudev.egg-info/SOURCES.txt
+++ b/src/pyudev.egg-info/SOURCES.txt
@@ -27,14 +27,6 @@ doc/api/pyudev.wx.rst
 doc/tests/index.rst
 doc/tests/plugins.rst
 doc/tests/running.rst
-reproducers/1255191.c
-reproducers/1263351.c
-reproducers/1263351a.c
-reproducers/1265315.c
-reproducers/1265315.py
-reproducers/1297512.c
-reproducers/1297512.py
-reproducers/1302359.c
 src/pyudev/__init__.py
 src/pyudev/_compat.py
 src/pyudev/_qt_base.py
@@ -57,14 +49,10 @@ src/pyudev/_ctypeslib/__init__.py
 src/pyudev/_ctypeslib/_errorcheckers.py
 src/pyudev/_ctypeslib/libc.py
 src/pyudev/_ctypeslib/libudev.py
+src/pyudev/_ctypeslib/utils.py
 src/pyudev/_os/__init__.py
 src/pyudev/_os/pipe.py
 src/pyudev/_os/poll.py
-src/pyudev/_parsing/__init__.py
-src/pyudev/_parsing/_devlink.py
-src/pyudev/_parsing/_id_path.py
-src/pyudev/_parsing/_pci_address.py
-src/pyudev/_parsing/_shared.py
 src/pyudev/device/__init__.py
 src/pyudev/device/_device.py
 src/pyudev/device/_errors.py
@@ -75,11 +63,9 @@ tests/test_core.py
 tests/test_device.py
 tests/test_discover.py
 tests/test_enumerate.py
-tests/test_libudev.py
 tests/test_monitor.py
 tests/test_observer.py
 tests/test_observer_deprecated.py
-tests/test_parsing.py
 tests/test_pypi.py
 tests/test_util.py
 tests/_device_tests/__init__.py
@@ -93,7 +79,5 @@ tests/plugins/mock_libudev.py
 tests/plugins/privileged.py
 tests/plugins/travis.py
 tests/utils/__init__.py
-tests/utils/journal.py
-tests/utils/libudev.py
 tests/utils/misc.py
 tests/utils/udev.py
\ No newline at end of file
diff --git a/src/pyudev/__init__.py b/src/pyudev/__init__.py
index 53bbfa1..0cb4ec6 100644
--- a/src/pyudev/__init__.py
+++ b/src/pyudev/__init__.py
@@ -34,16 +34,36 @@
     .. moduleauthor::  Sebastian Wiesner  <lunaryorn at gmail.com>
 """
 
-from __future__ import (print_function, division, unicode_literals,
-                        absolute_import)
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 
-__all__ = ['Context', 'Device']
+from pyudev.device import Attributes
+from pyudev.device import Device
+from pyudev.device import Devices
+from pyudev.device import DeviceNotFoundAtPathError
+from pyudev.device import DeviceNotFoundByFileError
+from pyudev.device import DeviceNotFoundByNameError
+from pyudev.device import DeviceNotFoundByNumberError
+from pyudev.device import DeviceNotFoundError
+from pyudev.device import DeviceNotFoundInEnvironmentError
+from pyudev.device import Tags
 
+from pyudev.discover import DeviceFileHypothesis
+from pyudev.discover import DeviceNameHypothesis
+from pyudev.discover import DeviceNumberHypothesis
+from pyudev.discover import DevicePathHypothesis
+from pyudev.discover import Discovery
+
+from pyudev.core import Context
+from pyudev.core import Enumerator
+
+from pyudev.monitor import Monitor
+from pyudev.monitor import MonitorObserver
 
-from pyudev.device import *
-from pyudev.discover import *
-from pyudev.core import *
-from pyudev.monitor import *
 from pyudev.version import __version__
 from pyudev.version import __version_info__
+
+from pyudev._util import udev_version
diff --git a/src/pyudev/_ctypeslib/_errorcheckers.py b/src/pyudev/_ctypeslib/_errorcheckers.py
index dd8377b..f4de520 100644
--- a/src/pyudev/_ctypeslib/_errorcheckers.py
+++ b/src/pyudev/_ctypeslib/_errorcheckers.py
@@ -49,10 +49,11 @@ def exception_from_errno(errnum):
 
     """
     exception = ERRNO_EXCEPTIONS.get(errnum)
+    errorstr = os.strerror(errnum)
     if exception is not None:
-        return exception()
+        return exception(errorstr)
     else:
-        return EnvironmentError(errnum, os.strerror(errnum))
+        return EnvironmentError(errnum, errorstr)
 
 
 def check_negative_errorcode(result, func, *args):
@@ -99,6 +100,7 @@ def check_errno_on_null_pointer_return(result, func, *args):
     raised.  Otherwise nothing happens.
 
     """
+    # pylint: disable=invalid-name
     if not result:
         errnum = get_errno()
         if errnum != 0:
diff --git a/src/pyudev/_ctypeslib/libc.py b/src/pyudev/_ctypeslib/libc.py
index 3f32036..112c73b 100644
--- a/src/pyudev/_ctypeslib/libc.py
+++ b/src/pyudev/_ctypeslib/libc.py
@@ -29,8 +29,7 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
-from ctypes import CDLL, c_int
-from ctypes.util import find_library
+from ctypes import c_int
 
 from ._errorcheckers import check_errno_on_nonzero_return
 
@@ -39,35 +38,9 @@ fd_pair = c_int * 2
 
 
 SIGNATURES = dict(
-    pipe2=([fd_pair, c_int], c_int),
+   pipe2=([fd_pair, c_int], c_int),
 )
 
 ERROR_CHECKERS = dict(
-    pipe2=check_errno_on_nonzero_return,
+   pipe2=check_errno_on_nonzero_return,
 )
-
-def load_c_library():
-    """Load the ``libc`` library and return a :class:`ctypes.CDLL` object for it.
- The library has errno handling enabled.
-
-    Important functions are given proper signatures and return types to support
-    type checking and argument conversion.
-
-    Raise :exc:`~exceptions.ImportError`, if the library was not found.
-
-    """
-    library_name = find_library('c')
-    if not library_name:
-        raise ImportError('No library named c')
-    libc = CDLL(library_name, use_errno=True)
-    # Add function signatures
-    for name, signature in SIGNATURES.items():
-        function = getattr(libc, name, None)
-        if function:
-            argtypes, restype = signature
-            function.argtypes = argtypes
-            function.restype = restype
-            errorchecker = ERROR_CHECKERS.get(name)
-            if errorchecker:
-                function.errcheck = errorchecker
-    return libc
diff --git a/src/pyudev/_ctypeslib/libudev.py b/src/pyudev/_ctypeslib/libudev.py
index 7536c9e..901b124 100644
--- a/src/pyudev/_ctypeslib/libudev.py
+++ b/src/pyudev/_ctypeslib/libudev.py
@@ -47,252 +47,237 @@ from ._errorcheckers import check_errno_on_null_pointer_return
 from ._errorcheckers import check_negative_errorcode
 
 
-class udev(Structure):
+class udev(Structure): # pylint: disable=invalid-name
     """
     Dummy for ``udev`` structure.
     """
     # pylint: disable=too-few-public-methods
     pass
 
-udev_p = POINTER(udev)
+udev_p = POINTER(udev) # pylint: disable=invalid-name
 
 
-class udev_enumerate(Structure):
+class udev_enumerate(Structure): # pylint: disable=invalid-name
     """
     Dummy for ``udev_enumerate`` structure.
     """
     # pylint: disable=too-few-public-methods
+    pass
 
-udev_enumerate_p = POINTER(udev_enumerate)
+udev_enumerate_p = POINTER(udev_enumerate) # pylint: disable=invalid-name
 
 
-class udev_list_entry(Structure):
+class udev_list_entry(Structure): # pylint: disable=invalid-name
     """
     Dummy for ``udev_list_entry`` structure.
     """
     # pylint: disable=too-few-public-methods
+    pass
 
-udev_list_entry_p = POINTER(udev_list_entry)
+udev_list_entry_p = POINTER(udev_list_entry) # pylint: disable=invalid-name
 
 
-class udev_device(Structure):
+class udev_device(Structure): # pylint: disable=invalid-name
     """
     Dummy for ``udev_device`` structure.
     """
     # pylint: disable=too-few-public-methods
+    pass
 
-udev_device_p = POINTER(udev_device)
+udev_device_p = POINTER(udev_device) # pylint: disable=invalid-name
 
 
-class udev_monitor(Structure):
+class udev_monitor(Structure): # pylint: disable=invalid-name
     """
     Dummy for ``udev_device`` structure.
     """
     # pylint: disable=too-few-public-methods
+    pass
 
-udev_monitor_p = POINTER(udev_monitor)
+udev_monitor_p = POINTER(udev_monitor) # pylint: disable=invalid-name
 
-class udev_hwdb(Structure):
+class udev_hwdb(Structure): # pylint: disable=invalid-name
     """
     Dummy for ``udev_hwdb`` structure.
     """
     # pylint: disable=too-few-public-methods
+    pass
 
-udev_hwdb_p = POINTER(udev_hwdb)
-
-
-dev_t = c_ulonglong
-
-
-SIGNATURES = {
-    # context
-    'udev': dict(
-        new=([], udev_p),
-        unref=([udev_p], None),
-        ref=([udev_p], udev_p),
-        get_sys_path=([udev_p], c_char_p),
-        get_dev_path=([udev_p], c_char_p),
-        get_run_path=([udev_p], c_char_p),
-        get_log_priority=([udev_p], c_int),
-        set_log_priority=([udev_p, c_int], None)),
-    # enumeration
-    'udev_enumerate': dict(
-        new=([udev_p], udev_enumerate_p),
-        ref=([udev_enumerate_p], udev_enumerate_p),
-        unref=([udev_enumerate_p], None),
-        add_match_subsystem=([udev_enumerate_p, c_char_p], c_int),
-        add_nomatch_subsystem=([udev_enumerate_p, c_char_p], c_int),
-        add_match_property=([udev_enumerate_p, c_char_p, c_char_p], c_int),
-        add_match_sysattr=([udev_enumerate_p, c_char_p, c_char_p], c_int),
-        add_nomatch_sysattr=([udev_enumerate_p, c_char_p, c_char_p], c_int),
-        add_match_tag=([udev_enumerate_p, c_char_p], c_int),
-        add_match_sysname=([udev_enumerate_p, c_char_p], c_int),
-        add_match_parent=([udev_enumerate_p, udev_device_p], c_int),
-        add_match_is_initialized=([udev_enumerate_p], c_int),
-        scan_devices=([udev_enumerate_p], c_int),
-        get_list_entry=([udev_enumerate_p], udev_list_entry_p)),
-    # list entries
-    'udev_list_entry': dict(
-        get_next=([udev_list_entry_p], udev_list_entry_p),
-        get_name=([udev_list_entry_p], c_char_p),
-        get_value=([udev_list_entry_p], c_char_p)),
-    # devices
-    'udev_device': dict(
-        ref=([udev_device_p], udev_device_p),
-        unref=([udev_device_p], None),
-        new_from_syspath=([udev_p, c_char_p], udev_device_p),
-        new_from_subsystem_sysname=([udev_p, c_char_p, c_char_p],
-                                    udev_device_p),
-        new_from_devnum=([udev_p, c_char, dev_t], udev_device_p),
-        new_from_device_id=([udev_p, c_char_p], udev_device_p),
-        new_from_environment=([udev_p], udev_device_p),
-        get_parent=([udev_device_p], udev_device_p),
-        get_parent_with_subsystem_devtype=([udev_device_p, c_char_p, c_char_p],
-                                           udev_device_p),
-        get_devpath=([udev_device_p], c_char_p),
-        get_subsystem=([udev_device_p], c_char_p),
-        get_syspath=([udev_device_p], c_char_p),
-        get_sysnum=([udev_device_p], c_char_p),
-        get_sysname=([udev_device_p], c_char_p),
-        get_driver=([udev_device_p], c_char_p),
-        get_devtype=([udev_device_p], c_char_p),
-        get_devnode=([udev_device_p], c_char_p),
-        get_property_value=([udev_device_p, c_char_p], c_char_p),
-        get_sysattr_value=([udev_device_p, c_char_p], c_char_p),
-        get_devnum=([udev_device_p], dev_t),
-        get_action=([udev_device_p], c_char_p),
-        get_seqnum=([udev_device_p], c_ulonglong),
-        get_is_initialized=([udev_device_p], c_int),
-        get_usec_since_initialized=([udev_device_p], c_ulonglong),
-        get_devlinks_list_entry=([udev_device_p], udev_list_entry_p),
-        get_tags_list_entry=([udev_device_p], udev_list_entry_p),
-        get_properties_list_entry=([udev_device_p], udev_list_entry_p),
-        get_sysattr_list_entry=([udev_device_p], udev_list_entry_p),
-        set_sysattr_value=([udev_device_p, c_char_p, c_char_p], c_int),
-        has_tag=([udev_device_p, c_char_p], c_int)),
-    # monitoring
-    'udev_monitor': dict(
-        ref=([udev_monitor_p], udev_monitor_p),
-        unref=([udev_monitor_p], None),
-        new_from_netlink=([udev_p, c_char_p], udev_monitor_p),
-        enable_receiving=([udev_monitor_p], c_int),
-        set_receive_buffer_size=([udev_monitor_p, c_int], c_int),
-        get_fd=([udev_monitor_p], c_int),
... 3674 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pyudev.git



More information about the Python-modules-commits mailing list