From: Erik Faye-Lund Date: Tue, 30 Jun 2020 10:09:31 +0000 (+0200) Subject: gallium/docs: prefix exts dir with underscore X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1d7bb2dde0dd0751f48adedfc3ca8dcaa7f2a4fb;p=mesa.git gallium/docs: prefix exts dir with underscore It's generally considered good practice to use underscore-prefixes for directories that contains non-doumentation files, so let's do this for our custom extensions as well. Acked-by: Alyssa Rosenzweig Acked-by: Eric Engestrom Part-of: --- diff --git a/src/gallium/docs/source/_exts/formatting.py b/src/gallium/docs/source/_exts/formatting.py new file mode 100644 index 00000000000..bc50c98051c --- /dev/null +++ b/src/gallium/docs/source/_exts/formatting.py @@ -0,0 +1,31 @@ +# formatting.py +# Sphinx extension providing formatting for Gallium-specific data +# (c) Corbin Simpson 2010 +# Public domain to the extent permitted; contact author for special licensing + +import docutils.nodes +import sphinx.addnodes + +def parse_envvar(env, sig, signode): + envvar, t, default = sig.split(" ", 2) + envvar = envvar.strip().upper() + t = " Type: %s" % t.strip(" <>").lower() + default = " Default: %s" % default.strip(" ()") + signode += sphinx.addnodes.desc_name(envvar, envvar) + signode += sphinx.addnodes.desc_type(t, t) + signode += sphinx.addnodes.desc_annotation(default, default) + return envvar + +def parse_opcode(env, sig, signode): + opcode, desc = sig.split("-", 1) + opcode = opcode.strip().upper() + desc = " (%s)" % desc.strip() + signode += sphinx.addnodes.desc_name(opcode, opcode) + signode += sphinx.addnodes.desc_annotation(desc, desc) + return opcode + +def setup(app): + app.add_object_type("envvar", "envvar", "%s (environment variable)", + parse_envvar) + app.add_object_type("opcode", "opcode", "%s (TGSI opcode)", + parse_opcode) diff --git a/src/gallium/docs/source/conf.py b/src/gallium/docs/source/conf.py index 972dcce6eb3..51cefc1c89b 100644 --- a/src/gallium/docs/source/conf.py +++ b/src/gallium/docs/source/conf.py @@ -16,7 +16,7 @@ import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.append(os.path.abspath('exts')) +sys.path.append(os.path.abspath('_exts')) # -- General configuration ----------------------------------------------------- diff --git a/src/gallium/docs/source/exts/formatting.py b/src/gallium/docs/source/exts/formatting.py deleted file mode 100644 index bc50c98051c..00000000000 --- a/src/gallium/docs/source/exts/formatting.py +++ /dev/null @@ -1,31 +0,0 @@ -# formatting.py -# Sphinx extension providing formatting for Gallium-specific data -# (c) Corbin Simpson 2010 -# Public domain to the extent permitted; contact author for special licensing - -import docutils.nodes -import sphinx.addnodes - -def parse_envvar(env, sig, signode): - envvar, t, default = sig.split(" ", 2) - envvar = envvar.strip().upper() - t = " Type: %s" % t.strip(" <>").lower() - default = " Default: %s" % default.strip(" ()") - signode += sphinx.addnodes.desc_name(envvar, envvar) - signode += sphinx.addnodes.desc_type(t, t) - signode += sphinx.addnodes.desc_annotation(default, default) - return envvar - -def parse_opcode(env, sig, signode): - opcode, desc = sig.split("-", 1) - opcode = opcode.strip().upper() - desc = " (%s)" % desc.strip() - signode += sphinx.addnodes.desc_name(opcode, opcode) - signode += sphinx.addnodes.desc_annotation(desc, desc) - return opcode - -def setup(app): - app.add_object_type("envvar", "envvar", "%s (environment variable)", - parse_envvar) - app.add_object_type("opcode", "opcode", "%s (TGSI opcode)", - parse_opcode)