Skip to content

Commit

Permalink
suppress non-pickleable functions warning
Browse files Browse the repository at this point in the history
  • Loading branch information
bkietz committed Nov 13, 2024
1 parent 12c7aa1 commit 6323ea8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
13 changes: 13 additions & 0 deletions cmake_modules/trike/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,19 @@ The macro will now be referencable as ``ASSERT(condition...)`` (Lookup of
be unchanged. In order to be recognized, the explicit directive must be the
first line of the ``///``, and there must be no space in the prefix ``///..``

Alternatively, you might want to hide a
`CRTP <https://en.cppreference.com/w/cpp/language/crtp>`_
base class from documentation:

.. code-block:: c++

///.. cpp:class:: template <typename T> Stream<T>
template <typename T>
class Stream<T> : impl::StreamMixin<T>

... that base class doesn't appear in the explicit directive, so sphinx will
never know about it.

Configuration
-------------

Expand Down
24 changes: 12 additions & 12 deletions cmake_modules/trike/trike/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,27 +649,27 @@ def run(self) -> list[Node]:

def setup(app: Sphinx) -> ExtensionMetadata:
app.add_config_value(
"trike_files",
[],
"env",
types=[list[Path]],
name="trike_files",
description="All C++ sources which will be scanned for ///",
default=[],
rebuild="env",
types=[list[Path]],
)

app.add_config_value(
"trike_clang_args",
[],
"env",
types=[list[str], Mapping[Path, str]],
name="trike_clang_args",
description="Arguments which will be passed to clang (or per-file mapping)",
default=[],
rebuild="env",
types=[list[str], Mapping[Path, str]],
)

# FIXME an unpickleable value causes the environment to *never* be reloadable
app.add_config_value(
"trike_get_uri",
None,
"env",
name="trike_get_uri",
description="A mapping from scanned C++ source to uri",
default=None,
rebuild="",
# really this should be rebuild="env", but functions are not pickleable
)

app.connect("builder-inited", _builder_inited)
Expand Down
1 change: 0 additions & 1 deletion sphinx_configuration/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"sphinx": ("https://www.sphinx-doc.org/en/master/usage/%s", None),
}

# TODO get trike files from cmake
trike_files = [
*maud.cache.CMAKE_SOURCE_DIR.glob("*.cxx"),
*maud.cache.CMAKE_SOURCE_DIR.glob("cmake_modules/*.cxx"),
Expand Down

0 comments on commit 6323ea8

Please sign in to comment.