Commit 606e71d3 authored by Iustin Pop's avatar Iustin Pop

Fix some issues in htools apidoc generation

First, auto-generated files were not processed if HsColour thus the
'source' link in Haddock documentation was dangling.

Second, we document the original Python constant name in the
Ganeti.Constants source, so that it's easily retrievable (as opposed
to undoing the name transformation).
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 48f12e73
......@@ -1107,7 +1107,7 @@ hs-apidoc: $(HS_BUILT_SRCS)
then OPTGHC="--optghc=$(HTOOLS_NOCURL)"; \
else OPTGHC=""; \
fi; \
RELSRCS="$(HS_LIB_SRCS:htools/%=%)"; \
RELSRCS="$(HS_LIB_SRCS:htools/%=%) $(HS_BUILT_SRCS:htools/%=%)"; \
for file in $$RELSRCS; do \
hfile=`echo $$file|sed 's/\\.hs$$//'`.html; \
$(HSCOLOUR) -css -anchor $$file > ../$(APIDOC_HS_DIR)/$$hfile ; \
......
......@@ -60,15 +60,19 @@ def Convert():
if not CONSTANT_RE.match(name):
lines.append("-- Skipped %s, not constant" % name)
elif isinstance(value, basestring):
lines.append("-- | Converted from Python constant %s" % name)
lines.append("%s :: String" % hs_name)
lines.append("%s = \"%s\"" % (hs_name, StringValueRules(value)))
elif isinstance(value, int):
lines.append("-- | Converted from Python constant %s" % name)
lines.append("%s :: Int" % hs_name)
lines.append("%s = %d" % (hs_name, value))
elif isinstance(value, long):
lines.append("-- | Converted from Python constant %s" % name)
lines.append("%s :: Integer" % hs_name)
lines.append("%s = %d" % (hs_name, value))
elif isinstance(value, float):
lines.append("-- | Converted from Python constant %s" % name)
lines.append("%s :: Double" % hs_name)
lines.append("%s = %f" % (hs_name, value))
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment