Zbigniew Jędrzejewski-Szmek | e7098b6 | 2012-11-13 18:39:18 +0100 | [diff] [blame] | 1 | # -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */ |
| 2 | # |
| 3 | # This file is part of systemd. |
| 4 | # |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 5 | # Copyright 2012-2013 Zbigniew Jędrzejewski-Szmek |
Zbigniew Jędrzejewski-Szmek | e7098b6 | 2012-11-13 18:39:18 +0100 | [diff] [blame] | 6 | # |
| 7 | # systemd is free software; you can redistribute it and/or modify it |
| 8 | # under the terms of the GNU Lesser General Public License as published by |
| 9 | # the Free Software Foundation; either version 2.1 of the License, or |
| 10 | # (at your option) any later version. |
| 11 | # |
| 12 | # systemd is distributed in the hope that it will be useful, but |
| 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | # Lesser General Public License for more details. |
| 16 | # |
| 17 | # You should have received a copy of the GNU Lesser General Public License |
| 18 | # along with systemd; If not, see <http://www.gnu.org/licenses/>. |
| 19 | |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 20 | import sys |
| 21 | import collections |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 22 | import re |
Zbigniew Jędrzejewski-Szmek | 1a13e31 | 2013-03-29 14:22:27 -0400 | [diff] [blame] | 23 | from xml_helper import * |
Zbigniew Jędrzejewski-Szmek | 827f70e | 2013-05-29 22:31:20 -0400 | [diff] [blame] | 24 | from copy import deepcopy |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 25 | |
| 26 | TEMPLATE = '''\ |
Zbigniew Jędrzejewski-Szmek | 56ba3c7 | 2013-02-02 22:47:47 -0500 | [diff] [blame] | 27 | <refentry id="systemd.directives" conditional="HAVE_PYTHON"> |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 28 | |
| 29 | <refentryinfo> |
| 30 | <title>systemd.directives</title> |
| 31 | <productname>systemd</productname> |
| 32 | |
| 33 | <authorgroup> |
| 34 | <author> |
| 35 | <contrib>Developer</contrib> |
| 36 | <firstname>Zbigniew</firstname> |
| 37 | <surname>Jędrzejewski-Szmek</surname> |
| 38 | <email>zbyszek@in.waw.pl</email> |
| 39 | </author> |
| 40 | </authorgroup> |
| 41 | </refentryinfo> |
| 42 | |
| 43 | <refmeta> |
| 44 | <refentrytitle>systemd.directives</refentrytitle> |
Zbigniew Jędrzejewski-Szmek | 9cc2c8b | 2013-01-14 22:08:33 -0500 | [diff] [blame] | 45 | <manvolnum>7</manvolnum> |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 46 | </refmeta> |
| 47 | |
| 48 | <refnamediv> |
| 49 | <refname>systemd.directives</refname> |
| 50 | <refpurpose>Index of configuration directives</refpurpose> |
| 51 | </refnamediv> |
| 52 | |
| 53 | <refsect1> |
| 54 | <title>Unit directives</title> |
| 55 | |
| 56 | <para>Directives for configuring units, used in unit |
| 57 | files.</para> |
| 58 | |
| 59 | <variablelist id='unit-directives' /> |
| 60 | </refsect1> |
Zbigniew Jędrzejewski-Szmek | e1abd3e | 2012-09-16 11:11:34 +0200 | [diff] [blame] | 61 | |
| 62 | <refsect1> |
Zbigniew Jędrzejewski-Szmek | 08177c8 | 2013-01-14 21:58:22 -0500 | [diff] [blame] | 63 | <title>Options on the kernel command line</title> |
| 64 | |
| 65 | <para>Kernel boot options for configuring the behaviour of the |
| 66 | systemd process.</para> |
| 67 | |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 68 | <variablelist id='kernel-commandline-options' /> |
Zbigniew Jędrzejewski-Szmek | 08177c8 | 2013-01-14 21:58:22 -0500 | [diff] [blame] | 69 | </refsect1> |
| 70 | |
| 71 | <refsect1> |
| 72 | <title>Environment variables</title> |
| 73 | |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 74 | <para>Environment variables understood by the systemd |
| 75 | manager and other programs.</para> |
Zbigniew Jędrzejewski-Szmek | 08177c8 | 2013-01-14 21:58:22 -0500 | [diff] [blame] | 76 | |
| 77 | <variablelist id='environment-variables' /> |
| 78 | </refsect1> |
| 79 | |
| 80 | <refsect1> |
Zbigniew Jędrzejewski-Szmek | e1abd3e | 2012-09-16 11:11:34 +0200 | [diff] [blame] | 81 | <title>UDEV directives</title> |
| 82 | |
| 83 | <para>Directives for configuring systemd units through the |
| 84 | udev database.</para> |
| 85 | |
| 86 | <variablelist id='udev-directives' /> |
| 87 | </refsect1> |
Zbigniew Jędrzejewski-Szmek | f6c2e28 | 2012-08-10 19:35:43 +0200 | [diff] [blame] | 88 | |
| 89 | <refsect1> |
Tom Gundersen | 1f06807 | 2013-11-10 19:33:18 +0100 | [diff] [blame] | 90 | <title>Network directives</title> |
| 91 | |
| 92 | <para>Directives for configuring network links through the |
Tom Gundersen | 46b0925 | 2013-11-10 20:52:53 +0100 | [diff] [blame] | 93 | net-setup-link udev builtin and networks through |
| 94 | systemd-networkd.</para> |
Tom Gundersen | 1f06807 | 2013-11-10 19:33:18 +0100 | [diff] [blame] | 95 | |
| 96 | <variablelist id='network-directives' /> |
| 97 | </refsect1> |
| 98 | |
| 99 | <refsect1> |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 100 | <title>Journal fields</title> |
Zbigniew Jędrzejewski-Szmek | f6c2e28 | 2012-08-10 19:35:43 +0200 | [diff] [blame] | 101 | |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 102 | <para>Fields in the journal events with a well known meaning.</para> |
Zbigniew Jędrzejewski-Szmek | f6c2e28 | 2012-08-10 19:35:43 +0200 | [diff] [blame] | 103 | |
| 104 | <variablelist id='journal-directives' /> |
| 105 | </refsect1> |
Zbigniew Jędrzejewski-Szmek | 4a431c9 | 2013-01-14 20:18:36 -0500 | [diff] [blame] | 106 | |
| 107 | <refsect1> |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 108 | <title>PAM configuration directives</title> |
| 109 | |
| 110 | <para>Directives for configuring PAM behaviour.</para> |
| 111 | |
| 112 | <variablelist id='pam-directives' /> |
| 113 | </refsect1> |
| 114 | |
| 115 | <refsect1> |
Zbigniew Jędrzejewski-Szmek | 63b03c0 | 2014-06-30 09:27:16 -0400 | [diff] [blame] | 116 | <title><filename>/etc/crypttab</filename> and |
| 117 | <filename>/etc/fstab</filename> options</title> |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 118 | |
| 119 | <para>Options which influence mounted filesystems and |
| 120 | encrypted volumes.</para> |
| 121 | |
Zbigniew Jędrzejewski-Szmek | 63b03c0 | 2014-06-30 09:27:16 -0400 | [diff] [blame] | 122 | <variablelist id='fstab-options' /> |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 123 | </refsect1> |
| 124 | |
| 125 | <refsect1> |
| 126 | <title>System manager directives</title> |
| 127 | |
| 128 | <para>Directives for configuring the behaviour of the |
| 129 | systemd process.</para> |
| 130 | |
| 131 | <variablelist id='systemd-directives' /> |
| 132 | </refsect1> |
| 133 | |
| 134 | <refsect1> |
Zbigniew Jędrzejewski-Szmek | 4a431c9 | 2013-01-14 20:18:36 -0500 | [diff] [blame] | 135 | <title>bootchart.conf directives</title> |
| 136 | |
| 137 | <para>Directives for configuring the behaviour of the |
| 138 | systemd-bootchart process.</para> |
| 139 | |
| 140 | <variablelist id='bootchart-directives' /> |
| 141 | </refsect1> |
Zbigniew Jędrzejewski-Szmek | 0acfdd6 | 2013-01-14 21:34:19 -0500 | [diff] [blame] | 142 | |
| 143 | <refsect1> |
Lennart Poettering | 81c7dd8 | 2014-11-06 20:06:30 +0100 | [diff] [blame^] | 144 | <title>command line options</title> |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 145 | |
| 146 | <para>Command-line options accepted by programs in the |
| 147 | systemd suite.</para> |
| 148 | |
| 149 | <variablelist id='options' /> |
| 150 | </refsect1> |
| 151 | |
| 152 | <refsect1> |
Zbigniew Jędrzejewski-Szmek | 785a51e | 2013-06-26 19:48:19 -0400 | [diff] [blame] | 153 | <title>Constants</title> |
| 154 | |
| 155 | <para>Various constant used and/or defined by systemd.</para> |
| 156 | |
| 157 | <variablelist id='constants' /> |
| 158 | </refsect1> |
| 159 | |
| 160 | <refsect1> |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 161 | <title>Miscellaneous options and directives</title> |
| 162 | |
| 163 | <para>Other configuration elements which don't fit in |
| 164 | any of the above groups.</para> |
| 165 | |
| 166 | <variablelist id='miscellaneous' /> |
| 167 | </refsect1> |
| 168 | |
| 169 | <refsect1> |
Zbigniew Jędrzejewski-Szmek | a4e0b94 | 2013-02-13 21:51:31 -0500 | [diff] [blame] | 170 | <title>Files and directories</title> |
| 171 | |
| 172 | <para>Paths and file names referred to in the |
| 173 | documentation.</para> |
| 174 | |
| 175 | <variablelist id='filenames' /> |
| 176 | </refsect1> |
| 177 | |
| 178 | <refsect1> |
Zbigniew Jędrzejewski-Szmek | 0acfdd6 | 2013-01-14 21:34:19 -0500 | [diff] [blame] | 179 | <title>Colophon</title> |
| 180 | <para id='colophon' /> |
| 181 | </refsect1> |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 182 | </refentry> |
| 183 | ''' |
| 184 | |
Zbigniew Jędrzejewski-Szmek | 0acfdd6 | 2013-01-14 21:34:19 -0500 | [diff] [blame] | 185 | COLOPHON = '''\ |
| 186 | This index contains {count} entries in {sections} sections, |
| 187 | referring to {pages} individual manual pages. |
| 188 | ''' |
| 189 | |
Zbigniew Jędrzejewski-Szmek | d970bd6 | 2013-01-26 11:27:35 -0500 | [diff] [blame] | 190 | def _extract_directives(directive_groups, formatting, page): |
Zbigniew Jędrzejewski-Szmek | 1a13e31 | 2013-03-29 14:22:27 -0400 | [diff] [blame] | 191 | t = xml_parse(page) |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 192 | section = t.find('./refmeta/manvolnum').text |
| 193 | pagename = t.find('./refmeta/refentrytitle').text |
Zbigniew Jędrzejewski-Szmek | a4e0b94 | 2013-02-13 21:51:31 -0500 | [diff] [blame] | 194 | |
| 195 | storopt = directive_groups['options'] |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 196 | for variablelist in t.iterfind('.//variablelist'): |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 197 | klass = variablelist.attrib.get('class') |
| 198 | storvar = directive_groups[klass or 'miscellaneous'] |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 199 | # <option>s go in OPTIONS, unless class is specified |
| 200 | for xpath, stor in (('./varlistentry/term/varname', storvar), |
| 201 | ('./varlistentry/term/option', |
| 202 | storvar if klass else storopt)): |
| 203 | for name in variablelist.iterfind(xpath): |
| 204 | text = re.sub(r'([= ]).*', r'\1', name.text).rstrip() |
| 205 | stor[text].append((pagename, section)) |
Zbigniew Jędrzejewski-Szmek | d970bd6 | 2013-01-26 11:27:35 -0500 | [diff] [blame] | 206 | if text not in formatting: |
| 207 | # use element as formatted display |
Zbigniew Jędrzejewski-Szmek | 699ad6c | 2013-02-27 21:31:02 -0500 | [diff] [blame] | 208 | if name.text[-1] in '= ': |
| 209 | name.clear() |
| 210 | else: |
| 211 | name.tail = '' |
Zbigniew Jędrzejewski-Szmek | d970bd6 | 2013-01-26 11:27:35 -0500 | [diff] [blame] | 212 | name.text = text |
| 213 | formatting[text] = name |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 214 | |
Zbigniew Jędrzejewski-Szmek | a4e0b94 | 2013-02-13 21:51:31 -0500 | [diff] [blame] | 215 | storfile = directive_groups['filenames'] |
Zbigniew Jędrzejewski-Szmek | 845c532 | 2013-05-03 00:55:20 -0400 | [diff] [blame] | 216 | for xpath, absolute_only in (('.//refsynopsisdiv//filename', False), |
| 217 | ('.//refsynopsisdiv//command', False), |
| 218 | ('.//filename', True)): |
Zbigniew Jędrzejewski-Szmek | a4e0b94 | 2013-02-13 21:51:31 -0500 | [diff] [blame] | 219 | for name in t.iterfind(xpath): |
Zbigniew Jędrzejewski-Szmek | 845c532 | 2013-05-03 00:55:20 -0400 | [diff] [blame] | 220 | if absolute_only and not (name.text and name.text.startswith('/')): |
| 221 | continue |
| 222 | if name.attrib.get('noindex'): |
| 223 | continue |
Zbigniew Jędrzejewski-Szmek | a4e0b94 | 2013-02-13 21:51:31 -0500 | [diff] [blame] | 224 | name.tail = '' |
| 225 | if name.text: |
Zbigniew Jędrzejewski-Szmek | 845c532 | 2013-05-03 00:55:20 -0400 | [diff] [blame] | 226 | if name.text.endswith('*'): |
| 227 | name.text = name.text[:-1] |
Zbigniew Jędrzejewski-Szmek | a4e0b94 | 2013-02-13 21:51:31 -0500 | [diff] [blame] | 228 | if not name.text.startswith('.'): |
| 229 | text = name.text.partition(' ')[0] |
| 230 | if text != name.text: |
| 231 | name.clear() |
| 232 | name.text = text |
Zbigniew Jędrzejewski-Szmek | 845c532 | 2013-05-03 00:55:20 -0400 | [diff] [blame] | 233 | if text.endswith('/'): |
| 234 | text = text[:-1] |
Zbigniew Jędrzejewski-Szmek | a4e0b94 | 2013-02-13 21:51:31 -0500 | [diff] [blame] | 235 | storfile[text].append((pagename, section)) |
| 236 | if text not in formatting: |
| 237 | # use element as formatted display |
| 238 | formatting[text] = name |
| 239 | else: |
| 240 | text = ' '.join(name.itertext()) |
| 241 | storfile[text].append((pagename, section)) |
| 242 | formatting[text] = name |
| 243 | |
Zbigniew Jędrzejewski-Szmek | 785a51e | 2013-06-26 19:48:19 -0400 | [diff] [blame] | 244 | storfile = directive_groups['constants'] |
| 245 | for name in t.iterfind('.//constant'): |
| 246 | if name.attrib.get('noindex'): |
| 247 | continue |
| 248 | name.tail = '' |
| 249 | if name.text.startswith('('): # a cast, strip it |
| 250 | name.text = name.text.partition(' ')[2] |
| 251 | storfile[name.text].append((pagename, section)) |
| 252 | formatting[name.text] = name |
| 253 | |
Zbigniew Jędrzejewski-Szmek | d970bd6 | 2013-01-26 11:27:35 -0500 | [diff] [blame] | 254 | def _make_section(template, name, directives, formatting): |
Zbigniew Jędrzejewski-Szmek | eeb019b | 2013-01-14 21:02:49 -0500 | [diff] [blame] | 255 | varlist = template.find(".//*[@id='{}']".format(name)) |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 256 | for varname, manpages in sorted(directives.items()): |
| 257 | entry = tree.SubElement(varlist, 'varlistentry') |
Zbigniew Jędrzejewski-Szmek | d970bd6 | 2013-01-26 11:27:35 -0500 | [diff] [blame] | 258 | term = tree.SubElement(entry, 'term') |
Zbigniew Jędrzejewski-Szmek | 827f70e | 2013-05-29 22:31:20 -0400 | [diff] [blame] | 259 | display = deepcopy(formatting[varname]) |
| 260 | term.append(display) |
Zbigniew Jędrzejewski-Szmek | d970bd6 | 2013-01-26 11:27:35 -0500 | [diff] [blame] | 261 | |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 262 | para = tree.SubElement(tree.SubElement(entry, 'listitem'), 'para') |
| 263 | |
| 264 | b = None |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 265 | for manpage, manvolume in sorted(set(manpages)): |
Zbigniew Jędrzejewski-Szmek | 827f70e | 2013-05-29 22:31:20 -0400 | [diff] [blame] | 266 | if b is not None: |
| 267 | b.tail = ', ' |
| 268 | b = tree.SubElement(para, 'citerefentry') |
| 269 | c = tree.SubElement(b, 'refentrytitle') |
| 270 | c.text = manpage |
| 271 | d = tree.SubElement(b, 'manvolnum') |
| 272 | d.text = manvolume |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 273 | entry.tail = '\n\n' |
| 274 | |
Zbigniew Jędrzejewski-Szmek | 0acfdd6 | 2013-01-14 21:34:19 -0500 | [diff] [blame] | 275 | def _make_colophon(template, groups): |
| 276 | count = 0 |
| 277 | pages = set() |
| 278 | for group in groups: |
| 279 | count += len(group) |
| 280 | for pagelist in group.values(): |
| 281 | pages |= set(pagelist) |
| 282 | |
| 283 | para = template.find(".//para[@id='colophon']") |
| 284 | para.text = COLOPHON.format(count=count, |
| 285 | sections=len(groups), |
| 286 | pages=len(pages)) |
| 287 | |
Zbigniew Jędrzejewski-Szmek | d970bd6 | 2013-01-26 11:27:35 -0500 | [diff] [blame] | 288 | def _make_page(template, directive_groups, formatting): |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 289 | """Create an XML tree from directive_groups. |
| 290 | |
| 291 | directive_groups = { |
| 292 | 'class': {'variable': [('manpage', 'manvolume'), ...], |
| 293 | 'variable2': ...}, |
| 294 | ... |
| 295 | } |
| 296 | """ |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 297 | for name, directives in directive_groups.items(): |
Zbigniew Jędrzejewski-Szmek | 827f70e | 2013-05-29 22:31:20 -0400 | [diff] [blame] | 298 | _make_section(template, name, directives, formatting) |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 299 | |
Zbigniew Jędrzejewski-Szmek | 0acfdd6 | 2013-01-14 21:34:19 -0500 | [diff] [blame] | 300 | _make_colophon(template, directive_groups.values()) |
| 301 | |
Zbigniew Jędrzejewski-Szmek | eeb019b | 2013-01-14 21:02:49 -0500 | [diff] [blame] | 302 | return template |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 303 | |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 304 | def make_page(*xml_files): |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 305 | "Extract directives from xml_files and return XML index tree." |
Zbigniew Jędrzejewski-Szmek | eeb019b | 2013-01-14 21:02:49 -0500 | [diff] [blame] | 306 | template = tree.fromstring(TEMPLATE) |
| 307 | names = [vl.get('id') for vl in template.iterfind('.//variablelist')] |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 308 | directive_groups = {name:collections.defaultdict(list) |
Zbigniew Jędrzejewski-Szmek | eeb019b | 2013-01-14 21:02:49 -0500 | [diff] [blame] | 309 | for name in names} |
Zbigniew Jędrzejewski-Szmek | d970bd6 | 2013-01-26 11:27:35 -0500 | [diff] [blame] | 310 | formatting = {} |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 311 | for page in xml_files: |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 312 | try: |
Zbigniew Jędrzejewski-Szmek | d970bd6 | 2013-01-26 11:27:35 -0500 | [diff] [blame] | 313 | _extract_directives(directive_groups, formatting, page) |
Zbigniew Jędrzejewski-Szmek | ccc9a4f | 2013-01-26 10:47:16 -0500 | [diff] [blame] | 314 | except Exception: |
| 315 | raise ValueError("failed to process " + page) |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 316 | |
Zbigniew Jędrzejewski-Szmek | d970bd6 | 2013-01-26 11:27:35 -0500 | [diff] [blame] | 317 | return _make_page(template, directive_groups, formatting) |
Zbigniew Jędrzejewski-Szmek | d9cfd69 | 2012-08-09 18:08:14 +0200 | [diff] [blame] | 318 | |
| 319 | if __name__ == '__main__': |
Zbigniew Jędrzejewski-Szmek | 1a13e31 | 2013-03-29 14:22:27 -0400 | [diff] [blame] | 320 | with open(sys.argv[1], 'wb') as f: |
| 321 | f.write(xml_print(make_page(*sys.argv[2:]))) |