Lines Matching +full:doc +full:- +full:path

2 # SPDX-License-Identifier: Apache-2.0
19 from pathlib import Path
24 ZEPHYR_BASE = Path(__file__).parents[2]
26 GENERIC_OR_VENDOR_INDEPENDENT = 'Generic or vendor-independent'
29 ZEPHYR_BASE = Path(__file__).parents[2]
31 # Base properties that have documentation in 'dt-important-props'.
59 # Load the vendor-prefixes.txt file. Return a dict mapping 'vnd'
65 # vnd A stand-in for a real vendor
67 # Gets split into a key 'vnd' and a value 'A stand-in for a real
77 logger.info('found %d vendor prefixes in %s', len(vnd2vendor) - 1,
92 # - The 'None' key maps to bindings with no vendor prefix
93 # in their compatibles, like 'gpio-keys'. This is the first key.
94 # - The (UNKNOWN_VENDOR,) key maps to bindings whose compatible
123 # The unknown-vendor bindings being inserted as a 1-tuple key is a
145 # - The None key maps to the ref target for bindings with no
146 # vendor prefix in their compatibles, like 'gpio-keys'
147 # - The (UNKNOWN_VENDOR,) key maps to the ref target for bindings
176 parser.add_argument('-v', '--verbose', default=0, action='count',
178 parser.add_argument('--vendor-prefixes', required=True,
179 help='vendor-prefixes.txt file path')
180 parser.add_argument('--dts-root', dest='dts_roots', action='append',
183 parser.add_argument('--dts-folder', dest='dts_folders', action='append', default=[],
185 parser.add_argument('--turbo-mode', action='store_true',
205 sys.exit('no DTS roots; use --dts-root to specify at least one')
222 # but rather a stand-in we use for examples and tests when a real
228 len(bindings), num_total - len(bindings), dts_roots)
236 # nodes from node-specific properties.
256 # - There is only one and only one file with a "#define DT_DRV_COMPAT <compatible>" for a given
258 # - or, a file contains both a "#define DT_DRV_COMPAT <compatible>" and a
266 filepath = Path(dirpath) / filename
267 with open(filepath, encoding="utf-8") as f:
291 path = occurrences[0]
293 if path.suffix == ".h":
294 path = path.parent
295 driver_sources[compatible] = path
305 out_dir = Path(out_dir)
315 # Make a set of all the Path objects we will be creating for
330 path = Path(dirpath) / filename
331 if path not in paths:
332 logger.info('removing unexpected file %s', path)
333 path.unlink()
370 See {zref('dt-bindings')} for an introduction to the Zephyr bindings
380 .. rst-class:: rst-columns
386 print(f'- :ref:`{vnd_lookup.target(vnd)}`', file=string_io)
399 .. rst-class:: rst-columns
401 - <compatible-A>
402 - <compatible-B> (on <bus-name> bus)
403 - <compatible-C>
404 - ...
406 The text "(on <bus-name> bus)" appears when bindings may behave
430 .. rst-class:: rst-columns
433 print(f'- :ref:`{binding_ref_target(binding)}`', file=string_io)
451 # a compatible are "disambiguation" pages that point to per-bus
460 # Next, write the per-binding pages. These contain the
461 # per-compatible targets for compatibles not in 'dup_compats'.
462 # We'll finish up by writing per-compatible "disambiguation" pages
537 <!--
540 -->
541 <style>.wy-nav-content {{ max-width: none; !important }}</style>
550 # Vendor: <link-to-vendor-section>
557 compatible = re.sub("[-,.@/+]", "_", compatible.lower())
600 print(f'- {specifier} cells: {", ".join(cells)}',
646 .. group-tab:: Node specific properties
652 .. group-tab:: Deprecated node specific properties
658 .. group-tab:: Base properties
668 print('No top-level properties.\n', file=string_io)
703 .. list-table::
705 :header-rows: 1
707 * - Name
708 - Type
709 - Details
740 details += (f'\n\nSee {zref("dt-important-props")} for more '
747 * - ``{prop_spec.name}``
748 - ``{prop_spec.type}``
749 - {textwrap.indent(details, ' ' * 7).lstrip()}
757 # Make a set of all the Path objects we will be creating for
768 for path in compatibles_dir.iterdir():
769 if path not in paths:
770 logger.info('removing unexpected file %s', path)
771 path.unlink()
781 output_list = '\n '.join(f'- :ref:`{binding_ref_target(binding)}`'
799 # Helper for dedenting and printing a triple-quoted RST block.
800 # (Just a block of text, not necessarily just a 'code-block'
806 # Converts 's', a string, to an indented rst .. code-block::. The
810 return ('.. code-block:: none\n\n' +
826 # Name of the per-compatible disambiguation page within the
838 # separate Sphinx doc set. Since we also link to Zephyr
841 # doc set.
844 # https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html
868 as_posix = Path(binding.path).as_posix()
872 if idx == -1:
873 raise ValueError(f'binding path has no {dts_bindings}: {binding.path}')
877 return os.path.splitext(as_posix[idx + len(dts_bindings):])[0] + '.rst'
882 stem = Path(binding.path).stem
883 return 'dtbinding_' + re.sub('[/,-]', '_', stem)
885 def write_if_updated(path, s): argument
889 if not path.parent.is_dir():
890 path.parent.mkdir(parents=True)
891 written = gen_helpers.write_if_updated(path, s)
892 logger.debug('%s %s', 'wrote' if written else 'did NOT write', path)