Lines Matching +full:stdout +full:- +full:path
1 # -*- coding: utf-8; mode: python -*-
14 handling from the author's POV. Directives like ``kernel-figure`` implement
15 methods *to* always get the best output-format even if some tools are not
19 * ``.. kernel-image``: for image handling / a ``.. image::`` replacement
21 * ``.. kernel-figure``: for figure handling / a ``.. figure::`` replacement
23 * ``.. kernel-render``: for render markup / a concept to embed *render*
26 - ``DOT``: render embedded Graphviz's **DOC**
27 - ``SVG``: render embedded Scalable Vector Graphics (**SVG**)
28 - ... *developable*
33 available, the DOT language is inserted as literal-block.
37 - ``convert(1)``: ImageMagick (https://www.imagemagick.org)
43 * generate SVG (html-builder) and PDF (latex-builder) from DOT files.
44 DOT: see http://www.graphviz.org/content/dot-language
49 from os import path
83 # -------------
86 """Searches the ``cmd`` in the ``PATH`` environment.
88 This *which* searches the PATH for executable ``cmd`` . First match is
91 envpath = os.environ.get('PATH', None) or os.defpath
94 if path.isfile(fname):
98 if not path.isdir(folder):
113 return (path.exists(path1)
120 # -------------------------------------------
131 app.connect('builder-inited', setupTools)
134 app.add_directive("kernel-image", KernelImage)
143 app.add_directive("kernel-figure", KernelFigure)
152 app.add_directive('kernel-render', KernelRender)
160 app.connect('doctree-read', add_kernel_figure_to_std_domain)
195 # --------------------------
215 fname, in_ext = path.splitext(path.basename(img_node['uri']))
217 src_fname = path.join(translator.builder.srcdir, img_node['uri'])
218 if not path.exists(src_fname):
219 src_fname = path.join(translator.builder.outdir, img_node['uri'])
223 # in kernel builds, use 'make SPHINXOPTS=-v' to see verbose messages
235 dst_fname = path.join(translator.builder.outdir, fname + '.pdf')
241 dst_fname = path.join(
245 img_node['uri'] = path.join(
248 '*': path.join(translator.builder.imgpath, fname + '.svg')}
262 dst_fname = path.join(translator.builder.outdir, fname + '.pdf')
277 mkdir(path.dirname(dst_fname))
298 option ``-Txxx``). Normally you will use one of the following extensions:
300 - ``.ps`` for PostScript,
301 - ``.svg`` or ``svgz`` for Structured Vector Graphics,
302 - ``.fig`` for XFIG graphics and
303 - ``.png`` or ``gif`` for common bitmap graphics.
306 out_format = path.splitext(out_fname)[1][1:]
307 cmd = [dot_cmd, '-T%s' % out_format, dot_fname]
311 exit_code = subprocess.call(cmd, stdout = out)
328 # use stdout and stderr from parent
336 # ---------------------
341 Handles the ``image`` child-node with the ``convert_image(...)``.
347 """Node for ``kernel-image`` directive."""
360 if uri.endswith('.*') or uri.find('://') != -1:
373 # ---------------------
378 Handles the ``image`` child-node with the ``convert_image(...)``.
384 """Node for ``kernel-figure`` directive."""
396 if uri.endswith('.*') or uri.find('://') != -1:
411 # ---------------------
419 image child-node with the ``convert_image(...)``.
424 kernellog.verbose(app, 'visit kernel-render node lang: "%s"' % (srclang))
428 kernellog.warn(app, 'kernel-render: "%s" unknown / include raw.' % (srclang))
438 hashobj = code.encode('utf-8') # str(node.attributes)
439 fname = path.join('%s-%s' % (srclang, sha1(hashobj).hexdigest()))
441 tmp_fname = path.join(
444 if not path.isfile(tmp_fname):
445 mkdir(path.dirname(tmp_fname))
450 img_node['uri'] = path.join(self.builder.imgpath, fname + tmp_ext)
452 '*': path.join(self.builder.imgpath, fname + tmp_ext)}
459 """Node for ``kernel-render`` directive."""
529 """Add kernel-figure anchors to 'std' domain.
532 the caption (label) of ``kernel-figure`` directive (it only knows about
534 this will result in a 'undefined label' for kernel-figures.
536 This handle adds labels of kernel-figure to the 'std' domain labels.