summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2018-05-02 11:08:09 +0100
committerSimon McVittie <smcv@collabora.com>2018-05-02 11:08:16 +0100
commit6c630a819f6504d48a3a205ab323b2d0458913e5 (patch)
treeea27051ef5ac3d8211892eed81b301f9d1fec34a
parent2d7f71cc7002b5d968f83adffe09e2fc8fd63eb5 (diff)
Convert documentation from epydoc to Sphinx
Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am72
-rw-r--r--README27
-rw-r--r--configure.ac63
-rw-r--r--dbus/__init__.py6
-rw-r--r--dbus/gi_service.py4
-rw-r--r--dbus/gobject_service.py2
-rw-r--r--dbus/service.py10
-rw-r--r--dbus_bindings/bytes.c6
-rw-r--r--dbus_bindings/containers.c38
-rw-r--r--dbus_bindings/int.c40
-rw-r--r--dbus_bindings/message-append.c3
-rw-r--r--dbus_bindings/signature.c6
-rw-r--r--dbus_bindings/string.c27
-rw-r--r--dbus_bindings/unixfd.c6
-rw-r--r--doc/HACKING.txt6
-rw-r--r--doc/PY3PORT.txt6
-rw-r--r--doc/_static/.gitignore0
-rw-r--r--doc/conf.py165
-rw-r--r--doc/dbus.bus.rst7
-rw-r--r--doc/dbus.connection.rst7
-rw-r--r--doc/dbus.decorators.rst7
-rw-r--r--doc/dbus.exceptions.rst7
-rw-r--r--doc/dbus.gi_service.rst7
-rw-r--r--doc/dbus.glib.rst7
-rw-r--r--doc/dbus.gobject_service.rst36
-rw-r--r--doc/dbus.lowlevel.rst7
-rw-r--r--doc/dbus.mainloop.rst18
-rw-r--r--doc/dbus.proxies.rst7
-rw-r--r--doc/dbus.rst35
-rw-r--r--doc/dbus.server.rst7
-rw-r--r--doc/dbus.service.rst7
-rw-r--r--doc/dbus.types.rst7
-rw-r--r--doc/index.rst53
-rw-r--r--doc/news.rst5
35 files changed, 519 insertions, 193 deletions
diff --git a/.gitignore b/.gitignore
index f8aad6d..371fd93 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,7 @@
/dbus_python.egg-info/
/depcomp
/dist/
+/doc/_build/
/install-sh
/libtool
/ltmain.sh
diff --git a/Makefile.am b/Makefile.am
index d0ed822..ae5f9de 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -416,36 +416,56 @@ _maintainer-update-htmldocs:
@echo "*** --enable-html-docs"
endif
-if ENABLE_API_DOCS
-all: api/index.html
-
-clean-local:
- rm -rf api
-
-APIDOC_PYTHONPATH = $(abs_top_srcdir):$(abs_top_builddir)/.libs
+sphinx_sources = \
+ doc/API_CHANGES.txt \
+ doc/conf.py \
+ doc/dbus.bus.rst \
+ doc/dbus.connection.rst \
+ doc/dbus.decorators.rst \
+ doc/dbus.exceptions.rst \
+ doc/dbus.gi_service.rst \
+ doc/dbus.glib.rst \
+ doc/dbus.gobject_service.rst \
+ doc/dbus.lowlevel.rst \
+ doc/dbus.mainloop.rst \
+ doc/dbus.proxies.rst \
+ doc/dbus.rst \
+ doc/dbus.server.rst \
+ doc/dbus.service.rst \
+ doc/dbus.types.rst \
+ doc/HACKING.txt \
+ doc/index.rst \
+ doc/news.rst \
+ doc/PY3PORT.txt \
+ doc/tutorial.txt \
+ NEWS \
+ README \
+ $(NULL)
+EXTRA_DIST += $(sphinx_sources)
-api api/index.html: $(nobase_python_PYTHON) \
- _dbus_bindings.la \
- _dbus_glib_bindings.la
- rm -rf api
- mkdir api
+if ENABLE_API_DOCS
+all: doc/_build/index.html
+
+doc/_build/index.html: $(nobase_python_PYTHON) \
+ _dbus_bindings.la \
+ _dbus_glib_bindings.la \
+ $(sphinx_sources) \
+ $(NULL)
+ rm -rf doc/_build
+ mkdir doc/_build
cd $(abs_top_srcdir) && \
- PYTHONPATH=$(APIDOC_PYTHONPATH) DBUS_PYTHON_NO_DEPRECATED=1 \
- $(PYTHON) -Wignore::DeprecationWarning \
- $(EPYDOC) -o $(abs_top_builddir)/api --html \
- --docformat restructuredtext -v \
- `find dbus -name '*.py' \
- | sed -e 's#/__init__\.py##g' \
- -e 's/\.py\>//g' -e 's#/#.#'g` \
- || { rm -rf api; exit 1; }
-
-_maintainer-update-apidocs: api
- rsync -rtvzPp --chmod=Dg+s,ug+rwX,o=rX api/ \
- dbus.freedesktop.org:/srv/dbus.freedesktop.org/www/doc/dbus-python/api/
+ abs_top_srcdir='$(abs_top_srcdir)' \
+ abs_top_builddir='$(abs_top_builddir)' \
+ DBUS_PYTHON_NO_DEPRECATED=1 \
+ $(PYTHON) -m sphinx -b html $(abs_top_srcdir)/doc doc/_build
+
+_maintainer-update-apidocs: doc/_build/index.html
+ rsync -rtvzPp --chmod=Dg+s,ug+rwX,o=rX doc/_build/ \
+ dbus.freedesktop.org:/srv/dbus.freedesktop.org/www/doc/dbus-python/
else
_maintainer-update-apidocs:
- @echo "*** Not updating the API docs on the website - install epydoc 3"
- @echo "*** alpha (or newer) and configure with --enable-api-docs"
+ @echo "*** Not updating the API docs on the website - install sphinx"
+ @echo "*** and configure with --enable-api-docs"
endif
check_c_sources = \
diff --git a/README b/README
index 7c1c49d..f46dbad 100644
--- a/README
+++ b/README
@@ -4,35 +4,12 @@ dbus-python_: Python bindings for D-Bus
.. _dbus-python: http://www.freedesktop.org/wiki/Software/DBusBindings#python
-Usage
-=====
+dbus-python is the original Python binding for ``dbus``, the reference
+implementation of the D-Bus protocol.
Online documentation can be found at
<http://dbus.freedesktop.org/doc/dbus-python/>.
-There is an incomplete tutorial in `doc/tutorial.txt`__
-(if you compile dbus-python with `docutils`_' ``rst2html`` tool installed or
-you're reading this document on the D-Bus website, there's also an
-`HTML version`__).
-
-__ doc/tutorial.txt
-__ doc/tutorial.html
-
-`API documentation`_ is generated if you compile dbus-python with `epydoc`_
-version 3 and `docutils`_ installed. An `online copy of the API documentation`_
-is also available.
-
-.. _API documentation: api/index.html
-.. _epydoc: http://epydoc.sourceforge.net/
-.. _docutils: http://docutils.sourceforge.net/
-.. _online copy of the API documentation:
- http://dbus.freedesktop.org/doc/dbus-python/api/
-
-To develop on dbus-python, see `doc/HACKING.txt`__ or the `HTML version`__.
-
-__ doc/HACKING.txt
-__ doc/HACKING.html
-
Problems and alternatives
=========================
diff --git a/configure.ac b/configure.ac
index 6376d15..0912a47 100644
--- a/configure.ac
+++ b/configure.ac
@@ -99,59 +99,22 @@ dnl Building documentation
AX_GENERATE_CHANGELOG
-AC_MSG_CHECKING([whether you want to build HTML docs])
-AC_ARG_ENABLE(html-docs,
-AC_HELP_STRING([--enable-html-docs], [Enable HTML documentation building (requires docutils, default: auto-detect)]), enable_html_docs=$enableval, enable_html_docs="if possible")
-AC_MSG_RESULT([$enable_html_docs])
-
-AC_MSG_CHECKING([whether you want to build API docs])
-AC_ARG_ENABLE(api-docs,
-AC_HELP_STRING([--enable-api-docs], [Enable API documentation building (requires epydoc 3 and docutils)]), enable_api_docs=$enableval, enable_api_docs="if possible")
-AC_MSG_RESULT([$enable_api_docs])
-
-
-AS_IF([test "$enable_api_docs" != no || test "$enable_html_docs" != no],
+AC_ARG_ENABLE([documentation],
+ [AC_HELP_STRING([--enable-documentation],
+ [Enable documentation building (requires sphinx and sphinx_rtd_theme)])],
+ [:],
+ [enable_documentation=no])
+AX_PYTHON_MODULE([sphinx])
+AS_IF([test "x$HAVE_PYMOD_SPHINX" = xno],
[
- AX_PYTHON_MODULE([docutils])
- AS_IF([test "$HAVE_PYMOD_DOCUTILS" = no],
- [
- AS_IF([test "$enable_api_docs" = "if possible"], [enable_api_docs=no])
- AS_IF([test "$enable_html_docs" = "if possible"], [enable_html_docs=no])
- AS_IF([test "$enable_api_docs" != no || test "$enable_html_docs" != no],
- [AC_MSG_ERROR([cannot compile HTML documentation or API documentation without python-docutils installed])])
- ])
+ AS_IF([test "$enable_documentation" != no],
+ [AC_MSG_ERROR([cannot build documentation without sphinx Python module])])
])
-
-AS_IF([test "${enable_api_docs}" != no],
+AX_PYTHON_MODULE([sphinx_rtd_theme])
+AS_IF([test "x$HAVE_PYMOD_SPHINX_RTD_THEME" = xno],
[
- AC_PATH_PROG([EPYDOC], [epydoc])
- AX_PYTHON_MODULE([epydoc])
- AC_MSG_CHECKING([epydoc 3])
- AS_IF([test -n "$EPYDOC" && test "$HAVE_PYMOD_EPYDOC" = yes],
- [
- EPYDOC_VERSION=`$EPYDOC --version`
- AS_CASE(["$EPYDOC_VERSION"],
- [*ersion?3*],
- [
- AC_MSG_RESULT([yes, $EPYDOC_VERSION])
- ],
- [*],
- [
- AC_MSG_RESULT([no, $EPYDOC_VERSION])
- EPYDOC=
- ])
- ],
- [
- EPYDOC=
- ])
- AS_IF([test -z "$EPYDOC"],
- [
- AS_CASE(["$enable_api_docs"],
- [if*possible],
- [enable_api_docs=no],
- [*],
- [AC_MSG_ERROR([cannot compile API documentation without epydoc 3.0beta1 or newer installed])])
- ])
+ AS_IF([test "$enable_documentation" != no],
+ [AC_MSG_ERROR([cannot build documentation without sphinx_rtd_theme Python module])])
])
AC_ARG_VAR([DBUS_RUN_SESSION],
diff --git a/dbus/__init__.py b/dbus/__init__.py
index e96bd99..a2aeac9 100644
--- a/dbus/__init__.py
+++ b/dbus/__init__.py
@@ -1,12 +1,6 @@
"""\
Implements the public API for a D-Bus client. See the dbus.service module
to export objects or claim well-known names.
-
-..
- for epydoc's benefit
-
-:NewField SupportedUsage: Supported usage
-:NewField Constructor: Constructor
"""
# Copyright (C) 2003, 2004, 2005, 2006 Red Hat Inc. <http://www.redhat.com/>
diff --git a/dbus/gi_service.py b/dbus/gi_service.py
index c182d0a..e091771 100644
--- a/dbus/gi_service.py
+++ b/dbus/gi_service.py
@@ -74,9 +74,7 @@ def ExportedGObject__init__(self, conn=None, object_path=None, **kwargs):
bus_name=bus_name)
ExportedGObject__doc__ = '''
-A GObject which is exported on the D-Bus.
-
-:undocumented: __gtype__
+A GObject which is exported on D-Bus.
'''
ExportedGObject = ExportedGObjectType(
diff --git a/dbus/gobject_service.py b/dbus/gobject_service.py
index 3d096c4..ef16009 100644
--- a/dbus/gobject_service.py
+++ b/dbus/gobject_service.py
@@ -55,8 +55,6 @@ class ExportedGObject(gobject.GObject, dbus.service.Object):
the naive approach using simple multiple inheritance won't work. This
class has `ExportedGObjectType` as its metaclass, which is sufficient
to make it work correctly.
-
- :undocumented: __gtype__
"""
__metaclass__ = ExportedGObjectType
diff --git a/dbus/service.py b/dbus/service.py
index 2953229..6093ac5 100644
--- a/dbus/service.py
+++ b/dbus/service.py
@@ -75,11 +75,11 @@ class BusName(object):
If a well-known name is requested multiple times, multiple references
to the same BusName object will be returned.
- Caveats
- -------
- - Assumes that named services are only ever requested using this class -
- if you request names from the bus directly, confusion may occur.
- - Does not handle queueing.
+ :Caveats:
+
+ - Assumes that named services are only ever requested using this class -
+ if you request names from the bus directly, confusion may occur.
+ - Does not handle queueing.
"""
def __new__(cls, name, bus=None, allow_replacement=False , replace_existing=False, do_not_queue=False):
"""Constructor, which may either return an existing cached object
diff --git a/dbus_bindings/bytes.c b/dbus_bindings/bytes.c
index b0ff817..af8188a 100644
--- a/dbus_bindings/bytes.c
+++ b/dbus_bindings/bytes.c
@@ -49,10 +49,10 @@ PyDoc_STRVAR(Byte_tp_doc,
"\n"
" dbus.Byte(integer or str of length 1[, variant_level])\n"
"\n"
-"``variant_level`` must be non-negative; the default is 0.\n"
+":py:attr:`variant_level` must be non-negative; the default is 0.\n"
+"\n"
+".. py:attribute:: variant_level\n"
"\n"
-":IVariables:\n"
-" `variant_level` : int\n"
" Indicates how many nested Variant containers this object\n"
" is contained in: if a message's wire format has a variant containing a\n"
" variant containing a byte, this is represented in Python by a\n"
diff --git a/dbus_bindings/containers.c b/dbus_bindings/containers.c
index e364f98..165f6fc 100644
--- a/dbus_bindings/containers.c
+++ b/dbus_bindings/containers.c
@@ -44,7 +44,7 @@ PyDoc_STRVAR(Array_tp_doc,
"\n"
" dbus.Array([iterable][, signature][, variant_level])\n"
"\n"
-"``variant_level`` must be non-negative; the default is 0.\n"
+":py:attr:`variant_level` must be non-negative; the default is 0.\n"
"\n"
"``signature`` is the D-Bus signature string for a single element of the\n"
"array, or None. If not None it must represent a single complete type, the\n"
@@ -53,13 +53,6 @@ PyDoc_STRVAR(Array_tp_doc,
"\n"
"If None (the default), when the Array is sent over\n"
"D-Bus, the item signature will be guessed from the first element.\n"
-"\n"
-":IVariables:\n"
-" `variant_level` : int\n"
-" Indicates how many nested Variant containers this object\n"
-" is contained in: if a message's wire format has a variant containing a\n"
-" variant containing an array, this is represented in Python by an\n"
-" Array with variant_level==2.\n"
);
static struct PyMemberDef Array_tp_members[] = {
@@ -68,8 +61,11 @@ static struct PyMemberDef Array_tp_members[] = {
"instance)"},
{"variant_level", T_LONG, offsetof(DBusPyArray, variant_level),
READONLY,
- "The number of nested variants wrapping the real data. "
- "0 if not in a variant."},
+ "Indicates how many nested Variant containers this object\n"
+ "is contained in: if a message's wire format has a variant containing a\n"
+ "variant containing an array, this is represented in Python by an\n"
+ "Array with variant_level==2.\n"
+ },
{NULL},
};
@@ -277,7 +273,7 @@ PyDoc_STRVAR(Dict_tp_doc,
"\n"
" Dictionary(mapping_or_iterable=(), signature=None, variant_level=0)\n"
"\n"
-"``variant_level`` must be non-negative; the default is 0.\n"
+":py:attr:`variant_level` must be non-negative; the default is 0.\n"
"\n"
"``signature`` is either a string or None. If a string, it must consist\n"
"of exactly two complete type signatures, representing the 'key' type\n"
@@ -288,13 +284,6 @@ PyDoc_STRVAR(Dict_tp_doc,
"If it is None (the default), when the Dictionary is sent over\n"
"D-Bus, the key and value signatures will be guessed from an arbitrary\n"
"element of the Dictionary.\n"
-"\n"
-":IVariables:\n"
-" `variant_level` : int\n"
-" Indicates how many nested Variant containers this object\n"
-" is contained in: if a message's wire format has a variant containing a\n"
-" variant containing an array of DICT_ENTRY, this is represented in\n"
-" Python by a Dictionary with variant_level==2.\n"
);
static struct PyMemberDef Dict_tp_members[] = {
@@ -303,8 +292,11 @@ static struct PyMemberDef Dict_tp_members[] = {
"that of each value in this Dictionary, as a Signature instance."},
{"variant_level", T_LONG, offsetof(DBusPyDict, variant_level),
READONLY,
- "The number of nested variants wrapping the real data. "
- "0 if not in a variant."},
+ "Indicates how many nested Variant containers this object\n"
+ "is contained in: if a message's wire format has a variant containing a\n"
+ "variant containing a dictionary, this is represented in Python by a\n"
+ "Dictionary with variant_level==2.\n"
+ },
{NULL},
};
@@ -540,10 +532,10 @@ PyDoc_STRVAR(Struct_tp_doc,
"If the signature is None (default) it will be guessed\n"
"from the types of the items during construction.\n"
"\n"
-"``variant_level`` must be non-negative; the default is 0.\n"
+":py:attr:`variant_level` must be non-negative; the default is 0.\n"
+"\n"
+".. py:attribute:: variant_level\n"
"\n"
-":IVariables:\n"
-" `variant_level` : int\n"
" Indicates how many nested Variant containers this object\n"
" is contained in: if a message's wire format has a variant containing a\n"
" variant containing a struct, this is represented in Python by a\n"
diff --git a/dbus_bindings/int.c b/dbus_bindings/int.c
index 66ad9e0..871a065 100644
--- a/dbus_bindings/int.c
+++ b/dbus_bindings/int.c
@@ -47,10 +47,10 @@ PyDoc_STRVAR(Boolean_tp_doc,
"\n"
"``value`` is converted to 0 or 1 as if by ``int(bool(value))``.\n"
"\n"
-"``variant_level`` must be non-negative; the default is 0.\n"
+":py:attr:`variant_level` must be non-negative; the default is 0.\n"
+"\n"
+".. py:attribute:: variant_level\n"
"\n"
-":IVariables:\n"
-" `variant_level` : int\n"
" Indicates how many nested Variant containers this object\n"
" is contained in: if a message's wire format has a variant containing a\n"
" variant containing a boolean, this is represented in Python by a\n"
@@ -160,8 +160,8 @@ PyDoc_STRVAR(Int16_tp_doc,
"\n"
" variant_level must be non-negative; the default is 0.\n"
"\n"
-":IVariables:\n"
-" `variant_level` : int\n"
+".. py:attribute:: variant_level\n"
+"\n"
" Indicates how many nested Variant containers this object\n"
" is contained in: if a message's wire format has a variant containing a\n"
" variant containing an int16, this is represented in Python by an\n"
@@ -248,10 +248,10 @@ PyDoc_STRVAR(UInt16_tp_doc,
"``value`` must be within the allowed range, or `OverflowError` will be\n"
"raised.\n"
"\n"
-"``variant_level`` must be non-negative; the default is 0.\n"
+":py:attr:`variant_level` must be non-negative; the default is 0.\n"
+"\n"
+".. py:attribute:: variant_level\n"
"\n"
-":IVariables:\n"
-" `variant_level` : int\n"
" Indicates how many nested Variant containers this object\n"
" is contained in: if a message's wire format has a variant containing a\n"
" variant containing a uint16, this is represented in Python by a\n"
@@ -340,10 +340,10 @@ PyDoc_STRVAR(Int32_tp_doc,
"``value`` must be within the allowed range, or `OverflowError` will be\n"
"raised.\n"
"\n"
-"``variant_level`` must be non-negative; the default is 0.\n"
+":py:attr:`variant_level` must be non-negative; the default is 0.\n"
+"\n"
+".. py:attribute:: variant_level\n"
"\n"
-":IVariables:\n"
-" `variant_level` : int\n"
" Indicates how many nested Variant containers this object\n"
" is contained in: if a message's wire format has a variant containing a\n"
" variant containing an int32, this is represented in Python by an\n"
@@ -433,10 +433,10 @@ PyDoc_STRVAR(UInt32_tp_doc,
"``value`` must be within the allowed range, or `OverflowError` will be\n"
"raised.\n"
"\n"
-"``variant_level`` must be non-negative; the default is 0.\n"
+":py:attr:`variant_level` must be non-negative; the default is 0.\n"
+"\n"
+".. py:attribute:: variant_level\n"
"\n"
-":IVariables:\n"
-" `variant_level` : int\n"
" Indicates how many nested Variant containers this object\n"
" is contained in: if a message's wire format has a variant containing a\n"
" variant containing a uint32, this is represented in Python by a\n"
@@ -537,10 +537,10 @@ PyDoc_STRVAR(Int64_tp_doc,
"``value`` must be within the allowed range, or `OverflowError` will be\n"
"raised.\n"
"\n"
-"``variant_level`` must be non-negative; the default is 0.\n"
+":py:attr:`variant_level` must be non-negative; the default is 0.\n"
+"\n"
+".. py:attribute:: variant_level\n"
"\n"
-":IVariables:\n"
-" `variant_level` : int\n"
" Indicates how many nested Variant containers this object\n"
" is contained in: if a message's wire format has a variant containing a\n"
" variant containing an int64, this is represented in Python by an\n"
@@ -644,10 +644,10 @@ PyDoc_STRVAR(UInt64_tp_doc,
"``value`` must be within the allowed range, or `OverflowError` will be\n"
"raised.\n"
"\n"
-"``variant_level`` must be non-negative; the default is 0.\n"
+":py:attr:`variant_level` must be non-negative; the default is 0.\n"
+"\n"
+".. py:attribute:: variant_level\n"
"\n"
-":IVariables:\n"
-" `variant_level` : int\n"
" Indicates how many nested Variant containers this object\n"
" is contained in: if a message's wire format has a variant containing a\n"
" variant containing a uint64, this is represented in Python by a\n"
diff --git a/dbus_bindings/message-append.c b/dbus_bindings/message-append.c
index d20b493..0480ceb 100644
--- a/dbus_bindings/message-append.c
+++ b/dbus_bindings/message-append.c
@@ -70,7 +70,8 @@ get_variant_level(PyObject *obj)
}
char dbus_py_Message_append__doc__[] = (
-"set_args(*args[, **kwargs])\n\n"
+"message.append(*args, **kwargs)\n"
+"\n"
"Set the message's arguments from the positional parameter, according to\n"
"the signature given by the ``signature`` keyword parameter.\n"
"\n"
diff --git a/dbus_bindings/signature.c b/dbus_bindings/signature.c
index e3a555c..574968b 100644
--- a/dbus_bindings/signature.c
+++ b/dbus_bindings/signature.c
@@ -42,10 +42,10 @@ PyDoc_STRVAR(Signature_tp_doc,
"``value`` must be a valid D-Bus signature (zero or more single complete\n"
"types).\n"
"\n"
-"``variant_level`` must be non-negative; the default is 0.\n"
+":py:attr:`variant_level` must be non-negative; the default is 0.\n"
+"\n"
+".. py:attribute:: variant_level\n"
"\n"
-":IVariables:\n"
-" `variant_level` : int\n"
" Indicates how many nested Variant containers this object\n"
" is contained in: if a message's wire format has a variant containing a\n"
" variant containing a signature, this is represented in Python by a\n"
diff --git a/dbus_bindings/string.c b/dbus_bindings/string.c
index 8363f98..32c1e31 100644
--- a/dbus_bindings/string.c
+++ b/dbus_bindings/string.c
@@ -129,19 +129,16 @@ PyTypeObject DBusPyUTF8String_Type = {
/* Object path ====================================================== */
PyDoc_STRVAR(ObjectPath_tp_doc,
-"A D-Bus object path, such as '/com/example/MyApp/Documents/abc'.\n"
+"dbus.ObjectPath(path: str[, variant_level: int=0])\n"
+"A D-Bus object path, such as ``/com/example/MyApp/Documents/abc``.\n"
"\n"
-"ObjectPath is a subtype of str, and object-paths behave like strings.\n"
-"\n"
-"Constructor::\n"
-"\n"
-" dbus.ObjectPath(path: str, variant_level: int) -> ObjectPath\n"
+"ObjectPath is a subtype of :py:class:`str`, and object-paths behave like strings.\n"
"\n"
"path must be an ASCII string following the syntax of object paths.\n"
"variant_level must be non-negative; the default is 0.\n"
"\n"
-":IVariables:\n"
-" `variant_level` : int\n"
+".. py:attribute:: variant_level\n"
+"\n"
" Indicates how many nested Variant containers this object\n"
" is contained in: if a message's wire format has a variant containing a\n"
" variant containing an object path, this is represented in Python by an\n"
@@ -223,20 +220,16 @@ PyDoc_STRVAR(String_tp_doc,
" String(value: str or unicode[, variant_level: int]) -> String\n"
"\n"
"variant_level must be non-negative; the default is 0.\n"
-"\n"
-":IVariables:\n"
-" `variant_level` : int\n"
-" Indicates how many nested Variant containers this object\n"
-" is contained in: if a message's wire format has a variant containing a\n"
-" variant containing a string, this is represented in Python by a\n"
-" String or UTF8String with variant_level==2.\n"
);
static PyMemberDef String_tp_members[] = {
{"variant_level", T_LONG, offsetof(DBusPyString, variant_level),
READONLY,
- "The number of nested variants wrapping the real data. "
- "0 if not in a variant"},
+ "Indicates how many nested Variant containers this object\n"
+ "is contained in: if a message's wire format has a variant containing a\n"
+ "variant containing an array, this is represented in Python by a\n"
+ "String or UTF8String with variant_level==2.\n"
+ },
{NULL},
};
diff --git a/dbus_bindings/unixfd.c b/dbus_bindings/unixfd.c
index 648dd2c..62a5acb 100644
--- a/dbus_bindings/unixfd.c
+++ b/dbus_bindings/unixfd.c
@@ -42,10 +42,10 @@ PyDoc_STRVAR(UnixFd_tp_doc,
"UnixFd keeps a dup() (duplicate) of the supplied file descriptor. The\n"
"caller remains responsible for closing the original fd.\n"
"\n"
-"``variant_level`` must be non-negative; the default is 0.\n"
+":py:attr:`variant_level` must be non-negative; the default is 0.\n"
+"\n"
+".. py:attribute:: variant_level\n"
"\n"
-":IVariables:\n"
-" `variant_level` : int\n"
" Indicates how many nested Variant containers this object\n"
" is contained in: if a message's wire format has a variant containing a\n"
" variant containing an Unix Fd, this is represented in Python by an\n"
diff --git a/doc/HACKING.txt b/doc/HACKING.txt
index c019198..b53655c 100644
--- a/doc/HACKING.txt
+++ b/doc/HACKING.txt
@@ -1,6 +1,6 @@
-=========================================
-D-Bus Python bindings - notes for hackers
-=========================================
+===============
+Developer notes
+===============
:Author: Simon McVittie, `Collabora`_
:Date: 2007-01-24
diff --git a/doc/PY3PORT.txt b/doc/PY3PORT.txt
index a028153..e159849 100644
--- a/doc/PY3PORT.txt
+++ b/doc/PY3PORT.txt
@@ -1,6 +1,6 @@
-===============================
-Porting python-dbus to Python 3
-===============================
+===================
+Porting to Python 3
+===================
This is an experimental port to Python 3.x where x >= 2. There are lots of
great sources for porting C extensions to Python 3, including:
diff --git a/doc/_static/.gitignore b/doc/_static/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/doc/_static/.gitignore
diff --git a/doc/conf.py b/doc/conf.py
new file mode 100644
index 0000000..f094a26
--- /dev/null
+++ b/doc/conf.py
@@ -0,0 +1,165 @@
+# -*- coding: utf-8 -*-
+#
+# Configuration file for the Sphinx documentation builder.
+#
+# This file does only contain a selection of the most common options. For a
+# full list see the documentation:
+# http://www.sphinx-doc.org/en/stable/config
+
+# -- Path setup --------------------------------------------------------------
+
+import os
+import sys
+
+sys.path.insert(0,
+ os.path.join(
+ os.environ.get('abs_top_builddir', os.path.abspath('..')),
+ '.libs',
+ ),
+)
+sys.path.insert(0, os.environ.get('abs_top_srcdir', os.path.abspath('..')))
+
+import _dbus_bindings
+
+# -- Project information -----------------------------------------------------
+
+project = u'dbus-python'
+copyright = u'2003-2018, D-Bus contributors'
+author = u'D-Bus contributors'
+
+# The short X.Y version
+version = _dbus_bindings.__version__
+# The full version, including alpha/beta/rc tags
+release = version
+
+
+# -- General configuration ---------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#
+# needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+ 'sphinx.ext.autodoc',
+ 'sphinx.ext.coverage',
+]
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix(es) of source filenames.
+# You can specify multiple suffix as a list of string:
+#
+# source_suffix = ['.rst', '.md']
+source_suffix = ['.rst', '.txt']
+
+# The master toctree document.
+master_doc = 'index'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#
+# This is also used if you do content translation via gettext catalogs.
+# Usually you set "language" from the command line for these cases.
+language = None
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+# This pattern also affects html_static_path and html_extra_path .
+exclude_patterns = [u'_build', 'Thumbs.db', '.DS_Store']
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+
+# -- Options for HTML output -------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+#
+html_theme = 'sphinx_rtd_theme'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#
+# html_theme_options = {}
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# Custom sidebar templates, must be a dictionary that maps document names
+# to template names.
+#
+# The default sidebars (for documents that don't match any pattern) are
+# defined by theme itself. Builtin themes are using these templates by
+# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
+# 'searchbox.html']``.
+#
+# html_sidebars = {}
+
+
+# -- Options for HTMLHelp output ---------------------------------------------
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'dbus-python'
+
+
+# -- Options for LaTeX output ------------------------------------------------
+
+latex_elements = {
+ # The paper size ('letterpaper' or 'a4paper').
+ #
+ # 'papersize': 'letterpaper',
+
+ # The font size ('10pt', '11pt' or '12pt').
+ #
+ # 'pointsize': '10pt',
+
+ # Additional stuff for the LaTeX preamble.
+ #
+ # 'preamble': '',
+
+ # Latex figure (float) alignment
+ #
+ # 'figure_align': 'htbp',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+# author, documentclass [howto, manual, or own class]).
+latex_documents = [
+ (master_doc, 'dbus-python.tex', u'dbus-python Documentation',
+ u'D-Bus contributors', 'manual'),
+]
+
+
+# -- Options for manual page output ------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ (master_doc, 'dbus-python', u'dbus-python Documentation',
+ [author], 3)
+]
+
+
+# -- Options for Texinfo output ----------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ (master_doc, 'dbus-python', u'dbus-python Documentation',
+ author, 'dbus-python',
+ 'Python bindings for the reference implementation of D-Bus.',
+ 'Miscellaneous'),
+]
+
+
+# -- Extension configuration -------------------------------------------------
diff --git a/doc/dbus.bus.rst b/doc/dbus.bus.rst
new file mode 100644
index 0000000..1f78f3e
--- /dev/null
+++ b/doc/dbus.bus.rst
@@ -0,0 +1,7 @@
+dbus.bus module
+===============
+
+.. automodule:: dbus.bus
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/doc/dbus.connection.rst b/doc/dbus.connection.rst
new file mode 100644
index 0000000..7b78212
--- /dev/null
+++ b/doc/dbus.connection.rst
@@ -0,0 +1,7 @@
+dbus.connection module
+======================
+
+.. automodule:: dbus.connection
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/doc/dbus.decorators.rst b/doc/dbus.decorators.rst
new file mode 100644
index 0000000..3f6625c
--- /dev/null
+++ b/doc/dbus.decorators.rst
@@ -0,0 +1,7 @@
+dbus.decorators module
+----------------------
+
+.. automodule:: dbus.decorators
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/doc/dbus.exceptions.rst b/doc/dbus.exceptions.rst
new file mode 100644
index 0000000..fea743c
--- /dev/null
+++ b/doc/dbus.exceptions.rst
@@ -0,0 +1,7 @@
+dbus.exceptions module
+----------------------
+
+.. automodule:: dbus.exceptions
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/doc/dbus.gi_service.rst b/doc/dbus.gi_service.rst
new file mode 100644
index 0000000..945d5a0
--- /dev/null
+++ b/doc/dbus.gi_service.rst
@@ -0,0 +1,7 @@
+dbus.gi\_service module
+-----------------------
+
+.. automodule:: dbus.gi_service
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/doc/dbus.glib.rst b/doc/dbus.glib.rst
new file mode 100644
index 0000000..20958be
--- /dev/null
+++ b/doc/dbus.glib.rst
@@ -0,0 +1,7 @@
+dbus.glib module
+----------------
+
+.. automodule:: dbus.glib
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/doc/dbus.gobject_service.rst b/doc/dbus.gobject_service.rst
new file mode 100644
index 0000000..b1ff1be
--- /dev/null
+++ b/doc/dbus.gobject_service.rst
@@ -0,0 +1,36 @@
+.. This is not done via automodule because it cannot be imported in
+.. Python 3.
+
+dbus.gobject\_service module
+----------------------------
+
+.. py:module:: gobject_service
+
+This module is only available when using Python 2, and is deprecated.
+
+.. py:class:: ExportedGObjectType(cls, name, bases, dct)
+
+ A metaclass which inherits from both GObjectMeta and
+ `dbus.service.InterfaceType`. Used as the metaclass for
+ `ExportedGObject`.
+
+.. py:class:: ExportedGObject(self, conn=None, object_path=None, **kwargs)
+
+ A GObject which is exported on the D-Bus.
+
+ Because GObject and `dbus.service.Object` both have custom metaclasses,
+ the naive approach using simple multiple inheritance won't work. This
+ class has `ExportedGObjectType` as its metaclass, which is sufficient
+ to make it work correctly.
+
+ :param dbus.connection.Connection conn:
+ The D-Bus connection or bus
+ :param str object_path:
+ The object path at which to register this object.
+ :keyword dbus.service.BusName bus_name:
+ A bus name to be held on behalf of this object, or None.
+ :keyword dict gobject_properties:
+ GObject properties to be set on the constructed object.
+
+ Any unrecognised keyword arguments will also be interpreted
+ as GObject properties.
diff --git a/doc/dbus.lowlevel.rst b/doc/dbus.lowlevel.rst
new file mode 100644
index 0000000..74e5f47
--- /dev/null
+++ b/doc/dbus.lowlevel.rst
@@ -0,0 +1,7 @@
+dbus.lowlevel module
+--------------------
+
+.. automodule:: dbus.lowlevel
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/doc/dbus.mainloop.rst b/doc/dbus.mainloop.rst
new file mode 100644
index 0000000..14bbf14
--- /dev/null
+++ b/doc/dbus.mainloop.rst
@@ -0,0 +1,18 @@
+dbus.mainloop package
+=====================
+
+Module contents
+---------------
+
+.. automodule:: dbus.mainloop
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+dbus.mainloop.glib module
+-------------------------
+
+.. automodule:: dbus.mainloop.glib
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/doc/dbus.proxies.rst b/doc/dbus.proxies.rst
new file mode 100644
index 0000000..8e4e8e3
--- /dev/null
+++ b/doc/dbus.proxies.rst
@@ -0,0 +1,7 @@
+dbus.proxies module
+-------------------
+
+.. automodule:: dbus.proxies
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/doc/dbus.rst b/doc/dbus.rst
new file mode 100644
index 0000000..2b2ab96
--- /dev/null
+++ b/doc/dbus.rst
@@ -0,0 +1,35 @@
+dbus package API reference
+==========================
+
+Submodules
+----------
+
+.. toctree::
+
+ dbus.bus
+ dbus.connection
+ dbus.decorators
+ dbus.exceptions
+ dbus.gi_service
+ dbus.lowlevel
+ dbus.mainloop
+ dbus.proxies
+ dbus.server
+ dbus.service
+ dbus.types
+
+Deprecated submodules
+---------------------
+
+.. toctree::
+
+ dbus.glib
+ dbus.gobject_service
+
+Module contents
+---------------
+
+.. automodule:: dbus
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/doc/dbus.server.rst b/doc/dbus.server.rst
new file mode 100644
index 0000000..c0d94c6
--- /dev/null
+++ b/doc/dbus.server.rst
@@ -0,0 +1,7 @@
+dbus.server module
+------------------
+
+.. automodule:: dbus.server
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/doc/dbus.service.rst b/doc/dbus.service.rst
new file mode 100644
index 0000000..61958d6
--- /dev/null
+++ b/doc/dbus.service.rst
@@ -0,0 +1,7 @@
+dbus.service module
+-------------------
+
+.. automodule:: dbus.service
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/doc/dbus.types.rst b/doc/dbus.types.rst
new file mode 100644
index 0000000..c02c788
--- /dev/null
+++ b/doc/dbus.types.rst
@@ -0,0 +1,7 @@
+dbus.types module
+-----------------
+
+.. automodule:: dbus.types
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/doc/index.rst b/doc/index.rst
new file mode 100644
index 0000000..ca754b5
--- /dev/null
+++ b/doc/index.rst
@@ -0,0 +1,53 @@
+=======================================
+dbus-python_: Python bindings for D-Bus
+=======================================
+
+.. _dbus-python: http://www.freedesktop.org/wiki/Software/DBusBindings#python
+
+dbus-python is a Python binding for ``dbus``, the reference implementation
+of the D-Bus protocol.
+
+Problems and alternatives
+=========================
+
+dbus-python might not be the best D-Bus binding for you to use. dbus-python
+does not follow the principle of "In the face of ambiguity, refuse the
+temptation to guess", and can't be changed to not do so without seriously
+breaking compatibility.
+
+In addition, it uses libdbus (which has known problems with multi-threaded
+use) and attempts to be main-loop-agnostic (which means you have to select
+a suitable main loop for your application).
+
+Alternative ways to get your Python code onto D-Bus include:
+
+* GDBus, part of the GIO module of `GLib`_, via GObject-Introspection and
+ `PyGI`_ (uses the GLib main loop and object model)
+
+* QtDBus, part of `Qt`_, via `PyQt`_ (uses the Qt main loop and object model)
+
+.. _GLib: http://developer.gnome.org/glib/
+.. _PyGI: https://live.gnome.org/PyGObject
+.. _Qt: https://qt.nokia.com/
+.. _PyQT: http://www.riverbankcomputing.co.uk/software/pyqt/intro
+
+Documentation
+=============
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Contents:
+
+ tutorial
+ dbus
+ PY3PORT
+ news
+ HACKING
+ API_CHANGES
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/doc/news.rst b/doc/news.rst
new file mode 100644
index 0000000..249c431
--- /dev/null
+++ b/doc/news.rst
@@ -0,0 +1,5 @@
+===============
+Release history
+===============
+
+.. include:: ../NEWS