Skip to content

Commit c260e9e

Browse files
committed
Change to support sphinx version 3
Previously sphinx version 2 was supported. Now *only* sphinx version 3 is supported. There are significant changes between sphinx 2 and sphinx 3 and there doesn't appear to be enough justification to keep supporting sphinx 2. closes: #6
1 parent 24e1bc0 commit c260e9e

32 files changed

+504
-329
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ jobs:
2121
run: |
2222
python -m pip install --upgrade pip
2323
pip install tox codecov
24+
25+
# Make libclang available for the parsing of the c files with the python clang package
26+
sudo ln -s /usr/lib/x86_64-linux-gnu/libclang-6.0.so.1 /usr/lib/x86_64-linux-gnu/libclang.so
2427
- name: Test with tox
2528
env:
2629
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2730
TOX_SKIP_ENV: py37$
2831
run: |
29-
# Make libclang available for the parsing of the c files with the python clang package
30-
sudo ln -s /usr/lib/x86_64-linux-gnu/libclang-6.0.so.1 /usr/lib/x86_64-linux-gnu/libclang.so
3132
tox
3233
cp tests/.coverage .
3334
codecov

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ This project adheres to `Semantic Versioning <https://semver.org/>`_.
99
`v0.3.0-dev`_ (unreleased)
1010
==========================
1111

12+
Changed
13+
-------
14+
15+
* Changed to support sphinx version 3. Due to significant changes between
16+
sphinx 2 and 3, sphinx 2 is no longer supported.
17+
1218
Fixes
1319
-----
1420

docs/_api/sphinx_c_autodoc.clang.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ sphinx\_c\_autodoc.clang.patches module
2020
:undoc-members:
2121
:show-inheritance:
2222

23-
2423
Module contents
2524
---------------
2625

docs/_api/sphinx_c_autodoc.domains.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ sphinx\_c\_autodoc.domains.c module
1212
:undoc-members:
1313
:show-inheritance:
1414

15-
1615
Module contents
1716
---------------
1817

docs/_api/sphinx_c_autodoc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Subpackages
55
-----------
66

77
.. toctree::
8+
:maxdepth: 4
89

910
sphinx_c_autodoc.clang
1011
sphinx_c_autodoc.domains
@@ -22,7 +23,6 @@ sphinx\_c\_autodoc.loader module
2223
:undoc-members:
2324
:show-inheritance:
2425

25-
2626
Module contents
2727
---------------
2828

docs/developer_notes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ AST:
1414
down of a C source file into its components. Normally an AST goes all the
1515
way down to things like if conditions and other constructs. However for
1616
the use in autodoc there is no reason to break down the contents of a
17-
function. Structures, unions and enumerations are further broken down
18-
into their member or enumeration constants though.
17+
function. Structures, unions and enums are further broken down into their
18+
member or enumerator constants though.
1919

2020
For this extension the common AST is just a simple dictionary which has
2121
the following entries:

docs/directives.rst

Lines changed: 58 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ instance from being added to the index provide this option.
5757
5858
- They are in a header file, ends in `.h`. By nature header files are meant to
5959
be included in other files, thus anything declared there is
60-
deamed public.
60+
deemed public.
6161
- They can be visible outside of the compilation unit. These are
6262
things the linker can get access to. Mainly this means functions
6363
and variables that are not static.
6464
6565
Just as for the standard `autodoc`_ options, one can use the negated
66-
form of ``:no-private-members:`` to selectivly turn off this option
66+
form of ``:no-private-members:`` to selectively turn off this option
6767
on a per module basis.
6868
6969
.. rst:directive:: .. autocfunction:: filename::function
@@ -78,17 +78,16 @@ instance from being added to the index provide this option.
7878

7979
.. rst:directive:: .. autocmacro:: filename::some_define
8080
81-
Document a C macro, or enumeration constant.
82-
83-
.. warning:: This should not be used for function like macros instead
84-
utilize the ``.. autocfunction::`` directive.
81+
Document a C macro. Both macro constants as well as function like
82+
macros.
8583

8684
.. rst:directive:: .. autoctype:: filename::typedef
8785
88-
Document a typedef, struct, union, or enum.
86+
Document a typedef
87+
88+
.. rst:directive:: .. autocenum:: filename::enum_name
8989
90-
.. warning:: This should not be used for enumeration constants instead
91-
utilize the ``.. autocmacro::`` directive.
90+
Document a enum
9291

9392
.. rst:directive:option:: members
9493
@@ -102,9 +101,56 @@ instance from being added to the index provide this option.
102101
automatically documented.
103102
- Specified as ``:no-members:``, no members will be automatically
104103
documented.
105-
- Specified with no arguments, ``:members:``, then all fields (if struct
106-
or union) or all enumeration constants (if an enum) will be recursively
104+
- Specified with no arguments, ``:members:``, then all enumerator
105+
constants will be documented.
106+
- Specified with a comma separated list of names,
107+
``:members: field_a, field_b``, only the items specified will be
108+
recursively documented.
109+
110+
.. rst:directive:: .. autocenumerator:: filename::enum_name.enumerator
111+
112+
Document a enumerator. One of the constant values of an enum.
113+
114+
.. rst:directive:: .. autocstruct:: filename::struct_name
115+
116+
Document a struct
117+
118+
.. rst:directive:option:: members
119+
120+
Specify which members to recursively document.
121+
122+
This option has 4 states:
123+
124+
- Omitted will result in the ``members`` entry of
125+
`autodoc_default_options`_ being used. If ``members`` is omitted
126+
from `autodoc_default_options`_ then no members will be
127+
automatically documented.
128+
- Specified as ``:no-members:``, no members will be automatically
107129
documented.
130+
- Specified with no arguments, ``:members:``, then all fields will be
131+
recursively documented.
132+
- Specified with a comma separated list of names,
133+
``:members: field_a, field_b``, only the items specified will be
134+
recursively documented.
135+
136+
.. rst:directive:: .. autocunion:: filename::union_name
137+
138+
Document a union
139+
140+
.. rst:directive:option:: members
141+
142+
Specify which members to recursively document.
143+
144+
This option has 4 states:
145+
146+
- Omitted will result in the ``members`` entry of
147+
`autodoc_default_options`_ being used. If ``members`` is omitted
148+
from `autodoc_default_options`_ then no members will be
149+
automatically documented.
150+
- Specified as ``:no-members:``, no members will be automatically
151+
documented.
152+
- Specified with no arguments, ``:members:``, then all fields will be
153+
recursively documented.
108154
- Specified with a comma separated list of names,
109155
``:members: field_a, field_b``, only the items specified will be
110156
recursively documented.
@@ -115,8 +161,7 @@ instance from being added to the index provide this option.
115161

116162
.. rst:directive:: .. autocmember:: filename::struct.field
117163
118-
Document the specified field (if a struct or union) or specified enumeration
119-
constant (if an enum).
164+
Document the specified field of a struct or union.
120165

121166
.. note:: This is one of the overloaded uses of the term **member**. This
122167
name was used to keep consistent with the `member`_ wording of the

docs/napoleon.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Using this extension will take:
2020

2121
and convert it into
2222

23-
.. autoctype:: example.c::members_documented_with_napoleon
23+
.. autocstruct:: example.c::members_documented_with_napoleon
2424
:members:
2525
:noindex:
2626

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"Source": "https://github.com/speedyleion/sphinx-c-autodoc",
3030
},
3131
install_requires=[
32-
"sphinx>=2,<3",
32+
"sphinx>=3",
3333
"clang>=6",
3434
"beautifulsoup4",
3535
],

0 commit comments

Comments
 (0)