1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-05 21:07:52 +00:00

Fix check_docs.py to work with cleaned up XML.

This commit is contained in:
Brenden Matthews 2009-06-07 21:23:35 -06:00
parent 25e46ca341
commit 6ebfffe542
4 changed files with 448 additions and 453 deletions

View File

@ -8,6 +8,9 @@
* Add entropy_perc printing the available entropy as percentage
* Add read_tcp to print stuff from tcp-sockets
2009-06-07
* Conky 1.7.1 released
2009-05-31
* Fix hostname resolution for mpd_host
* Made sure that no X11 stuff is in the binary with --disable-X11

View File

@ -29,7 +29,34 @@ file_names["config_settings"] = "doc/config_settings.xml"
for fn in file_names.values():
if not os.path.exists(fn) or not os.path.isfile(fn):
print "'%s' doesn't exist, or isn't a file" % (fn)
exit(0)
exit(1)
print 'sorting/tidying docs...'
# sort the docs by variable/config setting
import string
import xml.etree.ElementTree as ET
vars_xml = ET.parse(file_names['variables'])
config_xml = ET.parse(file_names['config_settings'])
getkey = lambda x: x.findtext('term/command/option')
vars = vars_xml.getroot()
vars[:] = sorted(vars, key=getkey)
configs = config_xml.getroot()
configs[:] = sorted(configs, key=getkey)
vars_xml.write(file_names['variables'])
config_xml.write(file_names['config_settings'])
def tidy(file):
command = ['tidy', '-qim', '-xml', '-utf8', '--indent-spaces', '4']
os.system('%s %s 2>/dev/null' % (string.join(command), file))
tidy(file_names['variables'])
tidy(file_names['config_settings'])
#
# Do all the objects first
@ -54,17 +81,14 @@ file.close()
doc_objects = []
exp = re.compile("\s*<command><option>(\w*)</option></command>.*")
print "checking docs -> objs consistency (in %s)" % (file_names["text_objects"])
file = open(file_names["variables"], "r")
while file:
line = file.readline()
if len(line) == 0:
break
res = exp.match(line)
if res:
doc_objects.append(res.group(1))
if doc_objects[len(doc_objects) - 1] != "templateN" and doc_objects[len(doc_objects) - 1] not in objects:
print " '%s' is documented, but doesn't seem to be an object" % (doc_objects[len(doc_objects) - 1])
file.close()
for var in vars:
term = getkey(var)
doc_objects.append(term)
if ['templaten', 'colorn'].count(doc_objects[len(doc_objects) - 1].lower()):
# ignore these
continue
if doc_objects[len(doc_objects) - 1] not in objects:
print " '%s' is documented, but doesn't seem to be an object" % (doc_objects[len(doc_objects) - 1])
print "done\n"
print "checking objs -> docs consistency (in %s)" % (file_names["variables"])
@ -77,7 +101,7 @@ print "done\n"
# Now we'll do config settings
#
configs = []
config_entries = []
file = open(file_names["conky"], "r")
exp1 = re.compile('\s*CONF\("(\w*)".*')
@ -96,28 +120,24 @@ while file:
conf = res.group(1)
if re.match("color\d", conf):
conf = "colorN"
if configs.count(conf) == 0:
configs.append(conf)
if config_entries.count(conf) == 0:
config_entries.append(conf)
file.close()
doc_configs = []
exp = re.compile("\s*<term><command><option>(\w*)</option></command>.*")
print "checking docs -> configs consistency (in %s)" % (file_names["conky"])
file = open(file_names["config_settings"], "r")
while file:
line = file.readline()
if len(line) == 0:
break
res = exp.match(line)
if res:
doc_configs.append(res.group(1))
if doc_configs[len(doc_configs) - 1] != "TEXT" and doc_configs[len(doc_configs) - 1] != "templateN" and doc_configs[len(doc_configs) - 1] not in configs:
print " '%s' is documented, but doesn't seem to be a config setting" % (doc_configs[len(doc_configs) - 1])
file.close()
for config in configs:
term = getkey(config)
doc_configs.append(term)
if ['text', 'templaten'].count(doc_configs[len(doc_configs) - 1].lower()):
# ignore these
continue
if doc_configs[len(doc_configs) - 1] not in config_entries:
print " '%s' is documented, but doesn't seem to be a config setting" % (doc_configs[len(doc_configs) - 1])
print "done\n"
print "checking configs -> docs consistency (in %s)" % (file_names["config_settings"])
for obj in configs:
for obj in config_entries:
if obj != "text" and obj != "template" and obj not in doc_configs:
print " '%s' seems to be undocumented" % (obj)
print "done\n"
@ -128,13 +148,13 @@ print "done\n"
for i in range(0, 10):
objects.append("color" + str(i))
configs.append("color" + str(i))
config_entries.append("color" + str(i))
objects.append("template" + str(i))
configs.append("template" + str(i))
config_entries.append("template" + str(i))
# Finally, sort everything.
objects.sort()
configs.sort()
config_entries.sort()
#
# Update nano syntax stuff
@ -156,7 +176,7 @@ for line in lines:
idx = lines.index(line)
lines.pop(idx) # remove old line
line = 'color green "\<('
for obj in configs:
for obj in config_entries:
line += "%s|" % (obj)
line = line[:len(line) - 1]
line += ')\>"\n'
@ -197,7 +217,7 @@ for line in lines:
idx = lines.index(line)
lines.pop(idx) # remove old line
line = 'syn keyword ConkyrcSetting '
for obj in configs:
for obj in config_entries:
line += "%s " % (obj)
line = line[:len(line) - 1]
line += '\n'
@ -217,32 +237,4 @@ file.seek(0)
file.writelines(lines)
file.close()
print 'sorting/tidying docs...'
# sort the docs by variable/config setting
import string
import xml.etree.ElementTree as ET
vars_xml = ET.parse(file_names['variables'])
config_xml = ET.parse(file_names['config_settings'])
getkey = lambda x: x.findtext('term/command/option')
vars = vars_xml.getroot()
vars[:] = sorted(vars, key=getkey)
configs = config_xml.getroot()
configs[:] = sorted(configs, key=getkey)
vars_xml.write(file_names['variables'])
config_xml.write(file_names['config_settings'])
def tidy(file):
command = ['tidy', '-qim', '-xml', '-utf8', '--indent-spaces', '4']
os.system('%s %s 2>/dev/null' % (string.join(command), file))
tidy(file_names['variables'])
tidy(file_names['config_settings'])
print "done."

View File

@ -8,7 +8,7 @@
<listitem>After this begins text to be formatted on screen.
Backslash (\) escapes newlines in the text section. This
can be useful for cleaning up config files where conky is
used to pipe input to dzen2.
used to pipe input to dzen2.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -24,7 +24,7 @@
delta} then you have to write the following: alias alpha
beta gamma delta . PS: Instead of creating an alias in the
config you can also use environment variables. Example:
Start conky like this: alpha="beta gamma delta" conky
Start conky like this: alpha="beta gamma delta" conky
<para /></listitem>
</varlistentry>
<varlistentry>
@ -37,7 +37,7 @@
top_right, top_middle, bottom_left, bottom_right,
bottom_middle, middle_left, middle_right, or none (also can
be abreviated as tl, tr, tm, bl, br, bm, ml, mr). See also
gap_x and gap_y.
gap_x and gap_y.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -46,7 +46,7 @@
<option>append_file</option>
</command>
</term>
<listitem>Append the file given as argument.
<listitem>Append the file given as argument.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -56,7 +56,7 @@
</command>
</term>
<listitem>Boolean value, if true, Conky will be forked to
background when started.
background when started.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -65,7 +65,7 @@
<option>border_margin</option>
</command>
</term>
<listitem>Border margin in pixels.
<listitem>Border margin in pixels.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -74,7 +74,7 @@
<option>border_width</option>
</command>
</term>
<listitem>Border width in pixels.
<listitem>Border width in pixels.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -86,7 +86,7 @@
<listitem>Predefine a color for use inside TEXT segments.
Substitute N by a digit between 0 and 9, inclusively. When
specifying the color value in hex, omit the leading hash
(#).
(#).
<para /></listitem>
</varlistentry>
<varlistentry>
@ -96,7 +96,7 @@
</command>
</term>
<listitem>The number of samples to average for CPU
monitoring.
monitoring.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -108,7 +108,7 @@
<listitem>Specify a default width and height for bars.
Example: 'default_bar_size 0 6'. This is particularly
useful for execbar and execibar as they do not take size
arguments.
arguments.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -117,7 +117,7 @@
<option>default_color</option>
</command>
</term>
<listitem>Default color and border color
<listitem>Default color and border color
<para /></listitem>
</varlistentry>
<varlistentry>
@ -129,7 +129,7 @@
<listitem>Specify a default width and height for gauges.
Example: 'default_gauge_size 25 25'. This is particularly
useful for execgauge and execigauge as they do not take
size arguments
size arguments
<para /></listitem>
</varlistentry>
<varlistentry>
@ -141,7 +141,7 @@
<listitem>Specify a default width and height for graphs.
Example: 'default_graph_size 0 25'. This is particularly
useful for execgraph and execigraph as they do not take
size arguments
size arguments
<para /></listitem>
</varlistentry>
<varlistentry>
@ -150,7 +150,7 @@
<option>default_outline_color</option>
</command>
</term>
<listitem>Default outline color
<listitem>Default outline color
<para /></listitem>
</varlistentry>
<varlistentry>
@ -159,7 +159,7 @@
<option>default_shade_color</option>
</command>
</term>
<listitem>Default shading color and border's shading color
<listitem>Default shading color and border's shading color
<para /></listitem>
</varlistentry>
<varlistentry>
@ -169,7 +169,7 @@
</command>
</term>
<listitem>The number of samples to average for disk I/O
monitoring.
monitoring.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -178,7 +178,7 @@
<option>display</option>
</command>
</term>
<listitem>Specify an X display to connect to.
<listitem>Specify an X display to connect to.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -189,7 +189,7 @@
</term>
<listitem>Use the Xdbe extension? (eliminates flicker) It
is highly recommended to use own window with this one so
double buffer won't be so big.
double buffer won't be so big.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -198,7 +198,7 @@
<option>draw_borders</option>
</command>
</term>
<listitem>Draw borders around text?
<listitem>Draw borders around text?
<para /></listitem>
</varlistentry>
<varlistentry>
@ -207,7 +207,7 @@
<option>draw_graph_borders</option>
</command>
</term>
<listitem>Draw borders around graphs?
<listitem>Draw borders around graphs?
<para /></listitem>
</varlistentry>
<varlistentry>
@ -216,7 +216,7 @@
<option>draw_outline</option>
</command>
</term>
<listitem>Draw outlines?
<listitem>Draw outlines?
<para /></listitem>
</varlistentry>
<varlistentry>
@ -225,7 +225,7 @@
<option>draw_shades</option>
</command>
</term>
<listitem>Draw shades?
<listitem>Draw shades?
<para /></listitem>
</varlistentry>
<varlistentry>
@ -235,7 +235,7 @@
</command>
</term>
<listitem>Font name in X, xfontsel can be used to get a
nice font
nice font
<para /></listitem>
</varlistentry>
<varlistentry>
@ -246,7 +246,7 @@
</term>
<listitem>Gap, in pixels, between right or left border of
screen, same as passing -x at command line, e.g. gap_x 10.
For other position related stuff, see 'alignment'.
For other position related stuff, see 'alignment'.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -257,7 +257,7 @@
</term>
<listitem>Gap, in pixels, between top or bottom border of
screen, same as passing -y at command line, e.g. gap_y 10.
For other position related stuff, see 'alignment'.
For other position related stuff, see 'alignment'.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -270,7 +270,7 @@
interface for being up? The value is one of up, link or
address, to check for the interface being solely up, being
up and having link or being up, having link and an assigned
IP address.
IP address.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -285,7 +285,7 @@
folder is 'INBOX', default interval is 5 minutes, and
default number of retries before giving up is 5. If the
password is supplied as '*', you will be prompted to enter
the password when Conky starts.
the password when Conky starts.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -294,7 +294,7 @@
<option>imlib_cache_flush_interval</option>
</command>
</term>
<listitem>Interval (in seconds) to flush Imlib2 cache.
<listitem>Interval (in seconds) to flush Imlib2 cache.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -305,7 +305,7 @@
</term>
<listitem>Imlib2 image cache size, in bytes. Defaults to
4MiB. Increase this value if you use $image lots. Set to 0
to disable the image cache.
to disable the image cache.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -314,7 +314,7 @@
<option>lua_load</option>
</command>
</term>
<listitem>Loads the Lua scripts separated by spaces.
<listitem>Loads the Lua scripts separated by spaces.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -323,7 +323,7 @@
<option>mail_spool</option>
</command>
</term>
<listitem>Mail spool for mail checking
<listitem>Mail spool for mail checking
<para /></listitem>
</varlistentry>
<varlistentry>
@ -333,7 +333,7 @@
</command>
</term>
<listitem>Allow each port monitor to track at most this
many connections (if 0 or not set, default is 256)
many connections (if 0 or not set, default is 256)
<para /></listitem>
</varlistentry>
<varlistentry>
@ -343,7 +343,7 @@
</command>
</term>
<listitem>Maximum number of special things, e.g. fonts,
offsets, aligns, etc. (default is 512)
offsets, aligns, etc. (default is 512)
<para /></listitem>
</varlistentry>
<varlistentry>
@ -354,7 +354,7 @@
<option>bytes</option>
</term>
<listitem>Maximum size of user text buffer, i.e. layout
below TEXT line in config file (default is 16384 bytes)
below TEXT line in config file (default is 16384 bytes)
<para /></listitem>
</varlistentry>
<varlistentry>
@ -364,7 +364,7 @@
</command>
<option>pixels</option>
</term>
<listitem>Maximum width of window
<listitem>Maximum width of window
<para /></listitem>
</varlistentry>
<varlistentry>
@ -374,7 +374,7 @@
</command>
<option>width (height)</option>
</term>
<listitem>Minimum size of window
<listitem>Minimum size of window
<para /></listitem>
</varlistentry>
<varlistentry>
@ -383,7 +383,7 @@
<option>mpd_host</option>
</command>
</term>
<listitem>Host of MPD server
<listitem>Host of MPD server
<para /></listitem>
</varlistentry>
<varlistentry>
@ -392,7 +392,7 @@
<option>mpd_password</option>
</command>
</term>
<listitem>MPD server password
<listitem>MPD server password
<para /></listitem>
</varlistentry>
<varlistentry>
@ -401,7 +401,7 @@
<option>mpd_port</option>
</command>
</term>
<listitem>Port of MPD server
<listitem>Port of MPD server
<para /></listitem>
</varlistentry>
<varlistentry>
@ -411,7 +411,7 @@
</command>
</term>
<listitem>Music player thread update interval (defaults to
Conky's update interval)
Conky's update interval)
<para /></listitem>
</varlistentry>
<varlistentry>
@ -420,7 +420,7 @@
<option>net_avg_samples</option>
</command>
</term>
<listitem>The number of samples to average for net data
<listitem>The number of samples to average for net data
<para /></listitem>
</varlistentry>
<varlistentry>
@ -430,7 +430,7 @@
</command>
</term>
<listitem>Substract (file system) buffers from used memory?
<para /></listitem>
</varlistentry>
<varlistentry>
@ -439,7 +439,7 @@
<option>out_to_console</option>
</command>
</term>
<listitem>Print text to stdout.
<listitem>Print text to stdout.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -448,7 +448,7 @@
<option>out_to_stderr</option>
</command>
</term>
<listitem>Print text to stderr.
<listitem>Print text to stderr.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -461,7 +461,7 @@
(useful when you also use things like out_to_console). If
you set it to no, make sure that it's placed before all
other X-related setting (take the first line of your
configfile to be sure). Default value is yes
configfile to be sure). Default value is yes
<para /></listitem>
</varlistentry>
<varlistentry>
@ -470,7 +470,7 @@
<option>override_utf8_locale</option>
</command>
</term>
<listitem>Force UTF8? requires XFT
<listitem>Force UTF8? requires XFT
<para /></listitem>
</varlistentry>
<varlistentry>
@ -479,7 +479,7 @@
<option>overwrite_file</option>
</command>
</term>
<listitem>Overwrite the file given as argument.
<listitem>Overwrite the file given as argument.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -488,7 +488,7 @@
<option>own_window</option>
</command>
</term>
<listitem>Boolean, create own window to draw?
<listitem>Boolean, create own window to draw?
<para /></listitem>
</varlistentry>
<varlistentry>
@ -498,7 +498,7 @@
</command>
</term>
<listitem>Manually set the WM_CLASS name. Defaults to
"Conky".
"Conky".
<para /></listitem>
</varlistentry>
<varlistentry>
@ -511,7 +511,7 @@
<listitem>If own_window_transparent no, set a specified
background colour (defaults to black). Takes either a hex
value (#ffffff) or a valid RGB name (see
/usr/lib/X11/rgb.txt)
/usr/lib/X11/rgb.txt)
<para /></listitem>
</varlistentry>
<varlistentry>
@ -527,7 +527,7 @@
own_window_type desktop as another way to implement many of
these hints implicitly. If you use own_window_type
override, window manager hints have no meaning and are
ignored.
ignored.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -537,7 +537,7 @@
</command>
</term>
<listitem>Manually set the window name. Defaults to
"&lt;hostname&gt; - conky".
"&lt;hostname&gt; - conky".
<para /></listitem>
</varlistentry>
<varlistentry>
@ -546,7 +546,7 @@
<option>own_window_transparent</option>
</command>
</term>
<listitem>Boolean, set pseudo-transparency?
<listitem>Boolean, set pseudo-transparency?
<para /></listitem>
</varlistentry>
<varlistentry>
@ -562,7 +562,7 @@
appear in your pager or taskbar; and are sticky across all
workspaces. Override windows are not under the control of
the window manager. Hints are ignored. This type of window
can be useful for certain situations.
can be useful for certain situations.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -572,7 +572,7 @@
</command>
</term>
<listitem>Pad percentages to this many decimals (0 = no
padding)
padding)
<para /></listitem>
</varlistentry>
<varlistentry>
@ -586,7 +586,7 @@
[-r retries]". Default port is 110, default interval is 5
minutes, and default number of retries before giving up is
5. If the password is supplied as '*', you will be prompted
to enter the password when Conky starts.
to enter the password when Conky starts.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -596,7 +596,7 @@
</command>
</term>
<listitem>Shortens units to a single character (kiB-&gt;k,
GiB-&gt;G, etc.). Default is off.
GiB-&gt;G, etc.). Default is off.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -605,7 +605,7 @@
<option>show_graph_range</option>
</command>
</term>
<listitem>Shows the time range covered by a graph.
<listitem>Shows the time range covered by a graph.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -614,7 +614,7 @@
<option>show_graph_scale</option>
</command>
</term>
<listitem>Shows the maximum value in scaled graphs.
<listitem>Shows the maximum value in scaled graphs.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -623,7 +623,7 @@
<option>stippled_borders</option>
</command>
</term>
<listitem>Border stippling (dashing) in pixels
<listitem>Border stippling (dashing) in pixels
<para /></listitem>
</varlistentry>
<varlistentry>
@ -634,7 +634,7 @@
</term>
<listitem>Desired output unit of all objects displaying a
temperature. Parameters are either "fahrenheit" or
"celsius". The default unit is degree Celsius.
"celsius". The default unit is degree Celsius.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -647,7 +647,7 @@
segments. Substitute N by a digit between 0 and 9,
inclusively. The value of the variable is being inserted
into the stuff below TEXT at the corresponding position,
but before some substitutions are applied:
but before some substitutions are applied:
<simplelist>
<member>'\n' -&gt; newline</member>
<member>'\\' -&gt; backslash</member>
@ -669,7 +669,7 @@
variables. Increasing the size of this buffer can
drastically reduce Conky's performance, but will allow for
more text display per variable. The size of this buffer
cannot be smaller than the default value of 256 bytes.
cannot be smaller than the default value of 256 bytes.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -680,7 +680,7 @@
</term>
<listitem>If true, cpu in top will show usage of one
processor's power. If false, cpu in top will show the usage
of all processors' power combined.
of all processors' power combined.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -690,7 +690,7 @@
</command>
</term>
<listitem>Width for $top name value (defaults to 15
characters).
characters).
<para /></listitem>
</varlistentry>
<varlistentry>
@ -700,7 +700,7 @@
</command>
</term>
<listitem>Total number of times for Conky to update before
quitting. Zero makes Conky run forever
quitting. Zero makes Conky run forever
<para /></listitem>
</varlistentry>
<varlistentry>
@ -709,7 +709,7 @@
<option>update_interval</option>
</command>
</term>
<listitem>Update interval in seconds
<listitem>Update interval in seconds
<para /></listitem>
</varlistentry>
<varlistentry>
@ -719,7 +719,7 @@
</command>
</term>
<listitem>Boolean value, if true, text is rendered in upper
case
case
<para /></listitem>
</varlistentry>
<varlistentry>
@ -733,7 +733,7 @@
and none (default). The old true/false values are
deprecated and default to right/none respectively. Note
that this only helps if you are using a mono font, such as
Bitstream Vera Sans Mono.
Bitstream Vera Sans Mono.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -742,7 +742,7 @@
<option>use_xft</option>
</command>
</term>
<listitem>Use Xft (anti-aliased font and stuff)
<listitem>Use Xft (anti-aliased font and stuff)
<para /></listitem>
</varlistentry>
<varlistentry>
@ -752,7 +752,7 @@
</command>
</term>
<listitem>Alpha of Xft font. Must be a value at or between
1 and 0.
1 and 0.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -761,7 +761,7 @@
<option>xftfont</option>
</command>
</term>
<listitem>Xft font to use.
<listitem>Xft font to use.
<para /></listitem>
</varlistentry>
</variablelist>

File diff suppressed because it is too large Load Diff