+doc_configs = []
+print "checking docs -> configs consistency (in %s)" % (file_names["conky"])
+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 config_entries:
+ if obj != "text" and obj != "template" and obj not in doc_configs:
+ print " '%s' seems to be undocumented" % (obj)
+print "done\n"
+
+
+
+# Cheat and add the colour/template stuff.
+
+for i in range(0, 10):
+ objects.append("color" + str(i))
+ config_entries.append("color" + str(i))
+ objects.append("template" + str(i))
+ config_entries.append("template" + str(i))
+
+# Finally, sort everything.
+objects.sort()
+config_entries.sort()
+
+#
+# Update nano syntax stuff
+#
+
+print "updating nano syntax...",
+sys.stdout.flush()
+file = open(file_names["nano_syntax"], "rw+")
+lines = []
+while file:
+ line = file.readline()
+ if len(line) == 0:
+ break
+ lines.append(line)
+
+# find the line we want to update
+for line in lines:
+ if re.match("color green ", line):
+ idx = lines.index(line)
+ lines.pop(idx) # remove old line
+ line = 'color green "\<('
+ for obj in config_entries:
+ line += "%s|" % (obj)
+ line = line[:len(line) - 1]
+ line += ')\>"\n'
+ lines.insert(idx, line)
+ if re.match("color brightblue ", line):
+ idx = lines.index(line)
+ lines.pop(idx) # remove old line
+ line = 'color brightblue "\<('
+ for obj in objects:
+ line += "%s|" % (obj)
+ line = line[:len(line) - 1]
+ line += ')\>"\n'
+ lines.insert(idx, line)
+ break # want to ignore everything after this line
+file.truncate(0)
+file.seek(0)
+file.writelines(lines)
+file.close()
+print "done."
+
+#
+# Update vim syntax stuff
+#
+
+print "updating vim syntax...",
+sys.stdout.flush()
+file = open(file_names["vim_syntax"], "rw+")
+lines = []
+while file:
+ line = file.readline()
+ if len(line) == 0:
+ break
+ lines.append(line)
+
+# find the line we want to update
+for line in lines:
+ if re.match("syn keyword ConkyrcSetting ", line):
+ idx = lines.index(line)
+ lines.pop(idx) # remove old line
+ line = 'syn keyword ConkyrcSetting '
+ for obj in config_entries:
+ line += "%s " % (obj)
+ line = line[:len(line) - 1]
+ line += '\n'
+ lines.insert(idx, line)
+ if re.match("syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite ", line):
+ idx = lines.index(line)
+ lines.pop(idx) # remove old line
+ line = 'syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite '
+ for obj in objects:
+ line += "%s " % (obj)
+ line = line[:len(line) - 1]
+ line += '\n'
+ lines.insert(idx, line)
+ break # want to ignore everything after this line
+file.truncate(0)
+file.seek(0)
+file.writelines(lines)
+file.close()
+
+# lastly, update the date in docs.xml
+file = open(file_names["docs"], 'r+')
+map = mmap.mmap(file.fileno(), os.path.getsize(file_names["docs"]))
+d = map.find("<date>")
+d += 6 # skip over first date stuff
+map[d:d+10] = datetime.now().strftime("%F")
+map.close()
+file.close()
+
+print "done."