pax_global_header 0000666 0000000 0000000 00000000064 11411030602 0014476 g ustar 00root root 0000000 0000000 52 comment=a9f8dd2b23c4fded0ae835c29f3584be4ff97369
nzjrs-python-gudev-ee8a644/ 0000775 0000000 0000000 00000000000 11411030602 0015715 5 ustar 00root root 0000000 0000000 nzjrs-python-gudev-ee8a644/.gitignore 0000664 0000000 0000000 00000000423 11411030602 0017704 0 ustar 00root root 0000000 0000000 .deps/
.libs/
INSTALL
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
config.guess
config.log
config.status
config.sub
configure
depcomp
gudev.c
*.la
*.lo
*.o
install-sh
libtool
ltmain.sh
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
missing
nzjrs-python-gudev-ee8a644/AUTHORS 0000664 0000000 0000000 00000000000 11411030602 0016753 0 ustar 00root root 0000000 0000000 nzjrs-python-gudev-ee8a644/COPYING 0000664 0000000 0000000 00000016727 11411030602 0016765 0 ustar 00root root 0000000 0000000 GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
nzjrs-python-gudev-ee8a644/Makefile.am 0000664 0000000 0000000 00000003316 11411030602 0017754 0 ustar 00root root 0000000 0000000 defsdir = $(datadir)/pygobject/2.0/defs
defs_DATA = gudev.defs
ACLOCAL_AMFLAGS = -I m4
INCLUDES = \
$(GUDEV_CFLAGS) \
$(GOBJECT_CFLAGS) \
$(PYGOBJECT_CFLAGS) \
$(PYTHON_INCLUDES)
pkgpythondir = $(pyexecdir)
pkgpyexecdir = $(pyexecdir)
pkgpyexec_LTLIBRARIES = gudev.la
gudev_la_LDFLAGS = -module -avoid-version -export-symbols-regex initgudev
gudev_la_LIBADD = $(GUDEV_LIBS) $(GOBJECT_LIBS) $(PYGOBJECT_LIBS)
gudev_la_SOURCES = gudevmodule.c gudev.c
#nodist_gudev_la_SOURCES = gudev.c
CLEANFILES = gudev.c
EXTRA_DIST = NEWS ChangeLog gudev.override $(defs_DATA) test.py
gudev.c: gudev.defs gudev.override
.defs.c:
(cd $(srcdir)\
&& $(PYGOBJECT_CODEGEN) \
--override $*.override \
--prefix py$* $*.defs) > gen-$*.c \
&& cp gen-$*.c $*.c \
&& rm -f gen-$*.c
update-defs:
$(PYGOBJECT_H2DEF) /usr/include/gudev-1.0/gudev/*.h > gudev-new.defs
# ChangeLog generation from nautils
distclean-local:
if test "$(srcdir)" = "."; then :; else \
rm -f ChangeLog; \
fi
ChangeLog:
@echo Creating $@
@if test -d "$(srcdir)/.git"; then \
(GIT_DIR=$(top_srcdir)/.git ./missing --run git log 147.1.. --stat -M -C --name-status --date=short --no-color) | fmt --split-only > $@.tmp \
&& mv -f $@.tmp $@ \
|| ($(RM) $@.tmp; \
echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \
(test -f $@ || echo git-log is required to generate this file >> $@)); \
else \
test -f $@ || \
(echo A git checkout and git-log is required to generate ChangeLog >&2 && \
echo A git checkout and git-log is required to generate this file >> $@); \
fi
release: dist
scp @PACKAGE@-@VERSION@.tar.gz root@greenbirdsystems.com:/var/www/johnstowers.co.nz/files/python-gudev/
.PHONY: ChangeLog update-defs
nzjrs-python-gudev-ee8a644/NEWS 0000664 0000000 0000000 00000000470 11411030602 0016415 0 ustar 00root root 0000000 0000000 NEW in 147.2:
* Bug fixes
NEW in 147.1:
=============
* Wrap those functions that return strv
* g_udev_device_get_device_file_symlinks
* g_udev_device_get_property_keys
* g_udev_device_get_property_as_strv
* g_udev_device_get_sysfs_attr_as_strv
NEW in 147.0:
=============
* Initial release
nzjrs-python-gudev-ee8a644/README 0000664 0000000 0000000 00000000172 11411030602 0016575 0 ustar 00root root 0000000 0000000 Python (PyGObject) bindings to the GUDev library.
GUDev API:
http://www.kernel.org/pub/linux/utils/kernel/hotplug/gudev/
nzjrs-python-gudev-ee8a644/autogen.sh 0000775 0000000 0000000 00000010676 11411030602 0017730 0 ustar 00root root 0000000 0000000 #!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
DIE=0
ACLOCAL_FLAGS="-I m4 $ACLOCAL_FLAGS"
if [ -n "$GNOME2_DIR" ]; then
ACLOCAL_FLAGS="-I $GNOME2_DIR/share/aclocal $ACLOCAL_FLAGS"
LD_LIBRARY_PATH="$GNOME2_DIR/lib:$LD_LIBRARY_PATH"
PATH="$GNOME2_DIR/bin:$PATH"
export PATH
export LD_LIBRARY_PATH
fi
(test -f $srcdir/configure.ac) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level package directory"
exit 1
}
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`autoconf' installed."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
(grep "^IT_PROG_INTLTOOL" $srcdir/configure.ac >/dev/null) && {
(intltoolize --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`intltool' installed."
echo "You can get it from:"
echo " ftp://ftp.gnome.org/pub/GNOME/"
DIE=1
}
}
(grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.ac >/dev/null) && {
(xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`xml-i18n-toolize' installed."
echo "You can get it from:"
echo " ftp://ftp.gnome.org/pub/GNOME/"
DIE=1
}
}
(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
(libtool --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`libtool' installed."
echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
}
(grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.ac >/dev/null) && {
(grep "sed.*POTFILES" $srcdir/configure.ac) > /dev/null || \
(glib-gettextize --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`glib' installed."
echo "You can get it from: ftp://ftp.gtk.org/pub/gtk"
DIE=1
}
}
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`automake' installed."
echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
DIE=1
NO_AUTOMAKE=yes
}
# if no automake, don't bother testing for aclocal
test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: Missing \`aclocal'. The version of \`automake'"
echo "installed doesn't appear recent enough."
echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
if test "$DIE" -eq 1; then
exit 1
fi
if test -z "$*"; then
echo "**Warning**: I am going to run \`configure' with no arguments."
echo "If you wish to pass any to it, please specify them on the"
echo \`$0\'" command line."
echo
fi
case $CC in
xlc )
am_opt=--include-deps;;
esac
for coin in `find $srcdir -path $srcdir/CVS -prune -o -name configure.ac -print`
do
dr=`dirname $coin`
if test -f $dr/NO-AUTO-GEN; then
echo skipping $dr -- flagged as no auto-gen
else
echo processing $dr
( cd $dr
aclocalinclude="$ACLOCAL_FLAGS"
if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then
echo "Creating $dr/aclocal.m4 ..."
test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
echo "Running glib-gettextize... Ignore non-fatal messages."
echo "no" | glib-gettextize --force --copy
echo "Making $dr/aclocal.m4 writable ..."
test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
fi
if grep "^IT_PROG_INTLTOOL" configure.ac >/dev/null; then
echo "Running intltoolize..."
intltoolize --copy --force --automake
fi
if grep "^AM_PROG_XML_I18N_TOOLS" configure.ac >/dev/null; then
echo "Running xml-i18n-toolize..."
xml-i18n-toolize --copy --force --automake
fi
if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
if test -z "$NO_LIBTOOLIZE" ; then
echo "Running libtoolize..."
libtoolize --force --copy
fi
fi
echo "Running aclocal $aclocalinclude ..."
aclocal $aclocalinclude
if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
echo "Running autoheader..."
autoheader
fi
echo "Running automake --gnu $am_opt ..."
automake --add-missing --gnu $am_opt
echo "Running autoconf ..."
autoconf
)
fi
done
conf_flags="--enable-maintainer-mode"
if test x$NOCONFIGURE = x; then
echo Running $srcdir/configure $conf_flags "$@" ...
$srcdir/configure $conf_flags "$@" \
&& echo Now type \`make\' to compile. || exit 1
else
echo Skipping configure process.
fi
nzjrs-python-gudev-ee8a644/configure.ac 0000664 0000000 0000000 00000002547 11411030602 0020213 0 ustar 00root root 0000000 0000000 AC_PREREQ(2.53)
AC_INIT(python-gudev, 147.2)
AC_CONFIG_SRCDIR(gudev.defs)
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AM_MAINTAINER_MODE
AC_PROG_MAKE_SET
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AM_PROG_LIBTOOL
AC_ARG_ENABLE(more-warnings,
[ --disable-more-warnings Inhibit compiler warnings],
set_more_warnings=no)
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
CFLAGS="$CFLAGS \
-Wall -Wstrict-prototypes -Wmissing-declarations \
-Wmissing-prototypes -Wnested-externs -Wpointer-arith"
fi
AM_PATH_PYTHON()
AM_CHECK_PYTHON_HEADERS(,AC_MSG_ERROR([install python-devel]))
PKG_CHECK_MODULES(PYGOBJECT, [pygobject-2.0 >= 2.18.0])
AC_MSG_CHECKING(for pygobject defs)
PYGOBJECT_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygobject-2.0`
AC_SUBST(PYGOBJECT_DEFSDIR)
AC_MSG_RESULT($PYGOBJECT_DEFSDIR)
AC_MSG_CHECKING(for pygobject codegen)
PYGOBJECT_CODEGEN="$PYTHON `$PKG_CONFIG --variable=codegendir pygobject-2.0`/codegen.py"
AC_SUBST(PYGOBJECT_CODEGEN)
AC_MSG_RESULT($PYGOBJECT_CODEGEN)
AC_MSG_CHECKING(for pygobject h2def)
PYGOBJECT_H2DEF="$PYTHON `$PKG_CONFIG --variable=codegendir pygobject-2.0`/h2def.py"
AC_SUBST(PYGOBJECT_H2DEF)
AC_MSG_RESULT($PYGOBJECT_H2DEF)
PKG_CHECK_MODULES(GUDEV, gudev-1.0 >= 147)
AC_OUTPUT([Makefile])
echo
echo $PACKAGE v$VERSION
echo
echo "Now type make to compile"
echo
nzjrs-python-gudev-ee8a644/gudev.defs 0000664 0000000 0000000 00000016040 11411030602 0017673 0 ustar 00root root 0000000 0000000 ;; FIXME: According to a comment in gudevtypes.h
;; GUdevDeviceNumber:
;; Corresponds to the standard #dev_t type as defined by POSIX (Until
;; bug 584517 is resolved this is aliased to an integer).
;;
;; So I have replaced all occurances od GUDevDeviceNumber with int
;; -*- scheme -*-
; object definitions ...
(define-object Client
(in-module "GUdev")
(parent "GObject")
(c-name "GUdevClient")
(gtype-id "G_UDEV_TYPE_CLIENT")
)
(define-object Device
(in-module "GUdev")
(parent "GObject")
(c-name "GUdevDevice")
(gtype-id "G_UDEV_TYPE_DEVICE")
)
;; Enumerations and flags ...
(define-enum DeviceType
(in-module "GUdev")
(c-name "GUdevDeviceType")
(gtype-id "G_TYPE_UDEV_DEVICE_TYPE")
(values
'("none" "G_UDEV_DEVICE_TYPE_NONE")
'("block" "G_UDEV_DEVICE_TYPE_BLOCK")
'("char" "G_UDEV_DEVICE_TYPE_CHAR")
)
)
;; From gudevclient.h
(define-function g_udev_client_get_type
(c-name "g_udev_client_get_type")
(return-type "GType")
)
(define-function g_udev_client_new
(c-name "g_udev_client_new")
(is-constructor-of "GUdevClient")
(return-type "GUdevClient*")
(parameters
'("const-gchar*-const*" "subsystems")
)
)
(define-method query_by_subsystem
(of-object "GUdevClient")
(c-name "g_udev_client_query_by_subsystem")
(return-type "GList*")
(parameters
'("const-gchar*" "subsystem" (null-ok) (default "NULL"))
)
)
(define-method query_by_device_number
(of-object "GUdevClient")
(c-name "g_udev_client_query_by_device_number")
(return-type "GUdevDevice*")
(parameters
'("GUdevDeviceType" "type")
;; '("GUdevDeviceNumber" "number")
'("int" "number")
)
)
(define-method query_by_device_file
(of-object "GUdevClient")
(c-name "g_udev_client_query_by_device_file")
(return-type "GUdevDevice*")
(parameters
'("const-gchar*" "device_file")
)
)
(define-method query_by_sysfs_path
(of-object "GUdevClient")
(c-name "g_udev_client_query_by_sysfs_path")
(return-type "GUdevDevice*")
(parameters
'("const-gchar*" "sysfs_path")
)
)
(define-method query_by_subsystem_and_name
(of-object "GUdevClient")
(c-name "g_udev_client_query_by_subsystem_and_name")
(return-type "GUdevDevice*")
(parameters
'("const-gchar*" "subsystem")
'("const-gchar*" "name")
)
)
;; From gudevdevice.h
(define-function g_udev_device_get_type
(c-name "g_udev_device_get_type")
(return-type "GType")
)
(define-method get_subsystem
(of-object "GUdevDevice")
(c-name "g_udev_device_get_subsystem")
(return-type "const-gchar*")
)
(define-method get_devtype
(of-object "GUdevDevice")
(c-name "g_udev_device_get_devtype")
(return-type "const-gchar*")
)
(define-method get_name
(of-object "GUdevDevice")
(c-name "g_udev_device_get_name")
(return-type "const-gchar*")
)
(define-method get_number
(of-object "GUdevDevice")
(c-name "g_udev_device_get_number")
(return-type "const-gchar*")
)
(define-method get_sysfs_path
(of-object "GUdevDevice")
(c-name "g_udev_device_get_sysfs_path")
(return-type "const-gchar*")
)
(define-method get_driver
(of-object "GUdevDevice")
(c-name "g_udev_device_get_driver")
(return-type "const-gchar*")
)
(define-method get_action
(of-object "GUdevDevice")
(c-name "g_udev_device_get_action")
(return-type "const-gchar*")
)
(define-method get_seqnum
(of-object "GUdevDevice")
(c-name "g_udev_device_get_seqnum")
(return-type "guint64")
)
(define-method get_device_type
(of-object "GUdevDevice")
(c-name "g_udev_device_get_device_type")
(return-type "GUdevDeviceType")
)
(define-method get_device_number
(of-object "GUdevDevice")
(c-name "g_udev_device_get_device_number")
;; (return-type "GUdevDeviceNumber")
(return-type "int")
)
(define-method get_device_file
(of-object "GUdevDevice")
(c-name "g_udev_device_get_device_file")
(return-type "const-gchar*")
)
(define-method get_device_file_symlinks
(of-object "GUdevDevice")
(c-name "g_udev_device_get_device_file_symlinks")
(return-type "const-gchar**")
)
(define-method get_parent
(of-object "GUdevDevice")
(c-name "g_udev_device_get_parent")
(return-type "GUdevDevice*")
)
(define-method get_parent_with_subsystem
(of-object "GUdevDevice")
(c-name "g_udev_device_get_parent_with_subsystem")
(return-type "GUdevDevice*")
(parameters
'("const-gchar*" "subsystem")
'("const-gchar*" "devtype")
)
)
(define-method get_property_keys
(of-object "GUdevDevice")
(c-name "g_udev_device_get_property_keys")
(return-type "const-gchar**")
)
(define-method has_property
(of-object "GUdevDevice")
(c-name "g_udev_device_has_property")
(return-type "gboolean")
(parameters
'("const-gchar*" "key")
)
)
(define-method get_property
(of-object "GUdevDevice")
(c-name "g_udev_device_get_property")
(return-type "const-gchar*")
(parameters
'("const-gchar*" "key")
)
)
(define-method get_property_as_int
(of-object "GUdevDevice")
(c-name "g_udev_device_get_property_as_int")
(return-type "gint")
(parameters
'("const-gchar*" "key")
)
)
(define-method get_property_as_uint64
(of-object "GUdevDevice")
(c-name "g_udev_device_get_property_as_uint64")
(return-type "guint64")
(parameters
'("const-gchar*" "key")
)
)
(define-method get_property_as_double
(of-object "GUdevDevice")
(c-name "g_udev_device_get_property_as_double")
(return-type "gdouble")
(parameters
'("const-gchar*" "key")
)
)
(define-method get_property_as_boolean
(of-object "GUdevDevice")
(c-name "g_udev_device_get_property_as_boolean")
(return-type "gboolean")
(parameters
'("const-gchar*" "key")
)
)
(define-method get_property_as_strv
(of-object "GUdevDevice")
(c-name "g_udev_device_get_property_as_strv")
(return-type "const-gchar**")
(parameters
'("const-gchar*" "key")
)
)
(define-method get_sysfs_attr
(of-object "GUdevDevice")
(c-name "g_udev_device_get_sysfs_attr")
(return-type "const-gchar*")
(parameters
'("const-gchar*" "name")
)
)
(define-method get_sysfs_attr_as_int
(of-object "GUdevDevice")
(c-name "g_udev_device_get_sysfs_attr_as_int")
(return-type "gint")
(parameters
'("const-gchar*" "name")
)
)
(define-method get_sysfs_attr_as_uint64
(of-object "GUdevDevice")
(c-name "g_udev_device_get_sysfs_attr_as_uint64")
(return-type "guint64")
(parameters
'("const-gchar*" "name")
)
)
(define-method get_sysfs_attr_as_double
(of-object "GUdevDevice")
(c-name "g_udev_device_get_sysfs_attr_as_double")
(return-type "gdouble")
(parameters
'("const-gchar*" "name")
)
)
(define-method get_sysfs_attr_as_boolean
(of-object "GUdevDevice")
(c-name "g_udev_device_get_sysfs_attr_as_boolean")
(return-type "gboolean")
(parameters
'("const-gchar*" "name")
)
)
(define-method get_sysfs_attr_as_strv
(of-object "GUdevDevice")
(c-name "g_udev_device_get_sysfs_attr_as_strv")
(return-type "const-gchar**")
(parameters
'("const-gchar*" "name")
)
)
;; From gudevenums.h
;; From gudevenumtypes.h
(define-function g_udev_device_type_get_type
(c-name "g_udev_device_type_get_type")
(return-type "GType")
)
;; From gudev.h
;; From gudevtypes.h
nzjrs-python-gudev-ee8a644/gudev.override 0000664 0000000 0000000 00000012745 11411030602 0020601 0 ustar 00root root 0000000 0000000 %%
headers
#include
#define G_UDEV_API_IS_SUBJECT_TO_CHANGE
#include
#include "pygobject.h"
/* Helper functions from gnome-python (gtksourceview) */
static PyObject *
glist_to_pylist_objs (const GList *source)
{
const GList *iter;
PyObject *dest = PyList_New (0);
for (iter = source; iter != NULL; iter = iter->next)
{
PyObject *item = pygobject_new ((GObject *)iter->data);
PyList_Append (dest, item);
Py_DECREF (item);
}
return dest;
}
static PyObject *
gslist_to_pylist_strs (const GSList *source)
{
const GSList *iter;
PyObject *dest = PyList_New (0);
for (iter = source; iter != NULL; iter = iter->next)
{
PyObject *item = PyString_FromString ((char *)iter->data);
PyList_Append (dest, item);
Py_DECREF (item);
}
return dest;
}
static PyObject *
strv_to_pylist (char **strv)
{
gsize len, i;
PyObject *list;
len = strv ? g_strv_length (strv) : 0;
list = PyList_New (len);
for (i = 0; i < len; i++)
PyList_SetItem (list, i, PyString_FromString (strv[i]));
return list;
}
static gboolean
pylist_to_strv (PyObject *list,
char ***strvp)
{
int i, len;
char **ret;
*strvp = NULL;
if (list == Py_None)
return TRUE;
if (!PySequence_Check (list))
{
PyErr_Format (PyExc_TypeError, "argument must be a list or tuple of strings");
return FALSE;
}
if ((len = PySequence_Size (list)) < 0)
return FALSE;
ret = g_new (char*, len + 1);
for (i = 0; i <= len; ++i)
ret[i] = NULL;
for (i = 0; i < len; ++i)
{
PyObject *item = PySequence_GetItem (list, i);
if (!item)
{
g_strfreev (ret);
return FALSE;
}
if (!PyString_Check (item))
{
Py_DECREF (item);
g_strfreev (ret);
PyErr_Format (PyExc_TypeError, "argument must be a list of strings");
return FALSE;
}
ret[i] = g_strdup (PyString_AsString (item));
Py_DECREF (item);
}
*strvp = ret;
return TRUE;
}
%%
modulename gudev
%%
import gobject.GObject as PyGObject_Type
%%
ignore-glob
*_get_type
%%
new-constructor G_UDEV_TYPE_CLIENT
%%
override g_udev_client_new
static int
_wrap_g_udev_client_new(PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "subsystems", NULL };
gchar **subsystems = NULL;
PyObject *list;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"O:GUdevClient.__init__",
kwlist,
&list))
return -1;
if (!pylist_to_strv(list, &subsystems)) {
PyErr_SetString(PyExc_RuntimeError, "could not convert list");
return -1;
}
pygobject_construct(self, "subsystems", subsystems, NULL);
if (!self->obj) {
PyErr_SetString(PyExc_RuntimeError, "could not create GUdevClient");
return -1;
}
return 0;
}
%%
override g_udev_client_query_by_subsystem kwargs
static PyObject *
_wrap_g_udev_client_query_by_subsystem (PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "subsystem", NULL };
gchar *subsystem = NULL;
GList *source;
PyObject *dest;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|z:GUdevClient.query_by_subsystem",
kwlist, &subsystem))
return NULL;
source = g_udev_client_query_by_subsystem(G_UDEV_CLIENT(self->obj), subsystem);
dest = glist_to_pylist_objs(source);
g_list_free(source);
return dest;
}
%%
override g_udev_device_get_device_file_symlinks noargs
static PyObject *
_wrap_g_udev_device_get_device_file_symlinks (PyGObject *self)
{
PyObject *py_ret;
const char * const *ret;
ret = g_udev_device_get_device_file_symlinks (G_UDEV_DEVICE (self->obj));
py_ret = strv_to_pylist ((char**) ret);
return py_ret;
}
%%
override g_udev_device_get_property_keys noargs
static PyObject *
_wrap_g_udev_device_get_property_keys (PyGObject *self)
{
PyObject *py_ret;
const char * const *ret;
ret = g_udev_device_get_property_keys (G_UDEV_DEVICE (self->obj));
py_ret = strv_to_pylist ((char**) ret);
return py_ret;
}
%%
override g_udev_device_get_property_as_strv kwargs
static PyObject *
_wrap_g_udev_device_get_property_as_strv (PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "key", NULL };
gchar *key = NULL;
PyObject *py_ret;
const char * const *ret;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:GUdevClient.get_property_as_strv",
kwlist, &key))
return NULL;
ret = g_udev_device_get_property_as_strv (G_UDEV_DEVICE (self->obj), key);
py_ret = strv_to_pylist ((char**) ret);
return py_ret;
}
%%
override g_udev_device_get_sysfs_attr_as_strv kwargs
static PyObject *
_wrap_g_udev_device_get_sysfs_attr_as_strv (PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "name", NULL };
gchar *name = NULL;
PyObject *py_ret;
const char * const *ret;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:GUdevClient.get_sysfs_attr_as_strv",
kwlist, &name))
return NULL;
ret = g_udev_device_get_sysfs_attr_as_strv (G_UDEV_DEVICE (self->obj), name);
py_ret = strv_to_pylist ((char**) ret);
return py_ret;
}
%%
// vim: filetype=c
nzjrs-python-gudev-ee8a644/gudevmodule.c 0000664 0000000 0000000 00000002354 11411030602 0020405 0 ustar 00root root 0000000 0000000 /*
* gudevmodule.
* Copyright (C) John Stowers 2010
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*/
#include
void pygudev_register_classes(PyObject *d);
extern PyMethodDef pygudev_functions[];
DL_EXPORT(void)
initgudev(void)
{
PyObject *m, *d;
init_pygobject();
m = Py_InitModule("gudev", pygudev_functions);
d = PyModule_GetDict(m);
pygudev_register_classes(d);
pygudev_add_constants(m, "G_UDEV_");
PyModule_AddObject(m, "__version__",
Py_BuildValue("s",VERSION));
if (PyErr_Occurred()) {
Py_FatalError("can't initialize module gudev");
}
}
nzjrs-python-gudev-ee8a644/m4/ 0000775 0000000 0000000 00000000000 11411030602 0016235 5 ustar 00root root 0000000 0000000 nzjrs-python-gudev-ee8a644/m4/Makefile.am 0000664 0000000 0000000 00000000057 11411030602 0020273 0 ustar 00root root 0000000 0000000 EXTRA_DIST = \
am-check-python-headers.m4 \
nzjrs-python-gudev-ee8a644/m4/am-check-python-headers.m4 0000664 0000000 0000000 00000002321 11411030602 0023075 0 ustar 00root root 0000000 0000000 dnl a macro to check for ability to create python extensions
dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
dnl function also defines PYTHON_INCLUDES
AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
[AC_REQUIRE([AM_PATH_PYTHON])
dnl deduce PYTHON_INCLUDES
AC_MSG_CHECKING(for Python headers using $PYTHON-config --includes)
PYTHON_INCLUDES=`$PYTHON-config --includes`
if test $? = 0; then
AC_MSG_RESULT($PYTHON_INCLUDES)
else
AC_MSG_RESULT([failed, will try another way])
py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
AC_MSG_CHECKING(for Python headers in $py_prefix and $py_exec_prefix)
PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
if test "$py_prefix" != "$py_exec_prefix"; then
PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
fi
AC_MSG_RESULT($PYTHON_INCLUDES)
fi
AC_MSG_CHECKING(whether those headers are sufficient)
AC_SUBST(PYTHON_INCLUDES)
dnl check if the headers exist:
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
AC_TRY_CPP([#include ],dnl
[AC_MSG_RESULT(yes)
$1],dnl
[AC_MSG_RESULT(no)
$2])
CPPFLAGS="$save_CPPFLAGS"
])
nzjrs-python-gudev-ee8a644/test.py 0000664 0000000 0000000 00000002553 11411030602 0017253 0 ustar 00root root 0000000 0000000 # Port of
# http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=extras/gudev/gjs-example.js
import sys
sys.path.insert(0, ".libs")
import gudev
import glib
print "GUDEV VERSION: %s" % gudev.__version__
def print_device(device):
print "subsystem", device.get_subsystem()
print "devtype", device.get_devtype()
print "name", device.get_name()
print "number", device.get_number()
print "sysfs_path:", device.get_sysfs_path()
print "driver:", device.get_driver()
print "action:", device.get_action()
print "seqnum:", device.get_seqnum()
print "device type:", device.get_device_type()
print "device number:", device.get_device_number()
print "device file:", device.get_device_file()
print "device file symlinks:", ", ".join(device.get_device_file_symlinks())
print "device keys:", ", ".join(device.get_property_keys())
for device_key in device.get_property_keys():
print " device property %s: %s" % (device_key, device.get_property(device_key))
def on_uevent(client, action, device):
print "UEVENT"
print_device(device)
print "------", device.get_property("ID_MEDIA_PLAYER")
client = gudev.Client(["block","usb"])
client.connect("uevent", on_uevent)
devices = client.query_by_subsystem("usb")
for device in devices:
print_device(device)
print "\n --- WAITING FOR EVENTS ---"
glib.MainLoop().run()