2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: AGPL-3.0
5 """pysdk_pdoc.py - Run pdoc with extra rendering options
7 This script is a wrapper around the standard `pdoc` tool that enables the
8 `admonitions` and `smarty-pants` extras for nicer rendering. It checks that
9 the version of `markdown2` included with `pdoc` supports those extras.
11 If run without arguments, it uses arguments to build the Arvados Python SDK
23 import pdoc.render_helpers
24 except ImportError as err:
25 if __name__ == '__main__':
33 '--output-directory=sdk/python',
34 '../sdk/python/build/lib/arvados/',
41 def main(arglist=None):
42 if _imp_err is not None:
43 print("error: failed to import pdoc:", _imp_err, file=sys.stderr)
45 # Ensure markdown2 is new enough to support our desired extras.
46 elif pdoc.markdown2.__version_info__ < (2, 4, 3):
47 print("error: need markdown2>=2.4.3 to render admonitions", file=sys.stderr)
50 # Configure pdoc to use extras we want.
51 pdoc.render_helpers.markdown_extensions = collections.ChainMap(
52 pdoc.render_helpers.markdown_extensions,
55 pdoc.__main__.cli(arglist)
58 if __name__ == '__main__':
59 sys.exit(main(sys.argv[1:] or DEFAULT_ARGLIST))