From: Rob Hoes Date: Fri, 30 Oct 2009 12:50:42 +0000 (+0000) Subject: [ocamldoc] Distinguish between libs and packs X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=723a763b4ec9a8821e69b2ec7e12153f7d7d6ca5;p=xcp%2Fxen-api-libs.git [ocamldoc] Distinguish between libs and packs Signed-off-by: Rob Hoes --- diff --git a/Makefile b/Makefile index 0c0a45a..78a75a3 100644 --- a/Makefile +++ b/Makefile @@ -145,9 +145,9 @@ xapi-libs: $(OUTPUT_XAPI_PKG) $(MY_SOURCES)/MANIFEST .PHONY: doc doc: + $(MAKE) -C uuid doc $(MAKE) -C stdext doc $(MAKE) -C sexpr doc - $(MAKE) -C uuid doc $(MAKE) -C log doc $(MAKE) -C xb doc $(MAKE) -C xc doc @@ -157,7 +157,6 @@ doc: $(MAKE) -C http-svr doc $(MAKE) -C camldm doc $(MAKE) -C cdrom doc - $(MAKE) -C close-and-exec doc $(MAKE) -C eventchn doc $(MAKE) -C pciutil doc $(MAKE) -C rss doc diff --git a/camldm/Makefile b/camldm/Makefile index 808d7cc..c83d145 100644 --- a/camldm/Makefile +++ b/camldm/Makefile @@ -64,7 +64,7 @@ uninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "camldm" "library" "$(OBJS)" "." "" "" + python ../doc/doc.py $(DOCDIR) "camldm" "package" "$(OBJS)" "." "" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) diff --git a/cdrom/Makefile b/cdrom/Makefile index ae7e8de..b84afd6 100644 --- a/cdrom/Makefile +++ b/cdrom/Makefile @@ -63,7 +63,7 @@ uninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "cdrom" "library" "$(OBJS)" "." "" "" + python ../doc/doc.py $(DOCDIR) "cdrom" "package" "$(OBJS)" "." "" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) diff --git a/doc/doc.py b/doc/doc.py index 527b825..abba485 100644 --- a/doc/doc.py +++ b/doc/doc.py @@ -21,24 +21,23 @@ xenapi_docdir = '/myrepos/xen-api.hg/ocaml/doc' docdir = sys.argv[1] name = sys.argv[2] -if sys.argv[3] == "library": is_library = True -else: is_library = False +ctype = sys.argv[3] modules = set(sys.argv[4].split()) includes = sys.argv[5].split() -packs = sys.argv[6] -libs = sys.argv[7] +packs = sys.argv[6].replace(',',' ').split() +libs = sys.argv[7].split() + +libs = list(set(libs)) # remove duplicates +packs = list(set(packs)) # remove duplicates dest = docdir + '/content/' + name try: os.makedirs(dest) except: pass - -packs = packs.replace(',', ' ') -packs = packs.split() if len(packs) > 0: - packages = "-package " + str(','.join(packs)) + packages = "-package " + ','.join(packs) else: packages = "" @@ -61,14 +60,13 @@ for i in includes: os.system(doc_command + ' ' + string.join(includesx) + ' ' + string.join(files)) -# add library dependencies to index files +# add dependencies to index files f = file(dest + '/index.json', 'a') -libs = libs.split() -libs.extend(packs) -libs = map(lambda s: '"' + s.split('/')[-1] + '"', libs) -libs = list(set(libs)) # remove duplicates -s = 'deps_' + name.replace("-", "") + ' = [' + ', '.join(libs) + '];' +packs_s = map(lambda s: '"' + s.split('/')[-1] + '"', packs) +libs_s = map(lambda s: '"' + s.split('/')[-1] + '"', libs) +s = 'deps_' + name.replace("-", "") + ' = {"packs": [' + ', '.join(packs_s) + '], ' +s += '"libs": [' + ', '.join(libs_s) + ']}' f.write(s) f.close() @@ -77,25 +75,31 @@ f.close() def update_components(compdir): executables = [] libraries = [] - + packages = [] + try: f = file(compdir + '/components.js', 'r') exec(f.readline()) exec(f.readline()) + exec(f.readline()) f.close() except: pass - if is_library: + if ctype == "library": libraries.append(name) libraries = list(set(libraries)) + elif ctype == "package": + packages.append(name) + packages = list(set(packages)) else: executables.append(name) executables = list(set(executables)) f = file(compdir + '/components.js', 'w') f.write('executables = ' + str(executables) + '\n') - f.write('libraries = ' + str(libraries)) + f.write('libraries = ' + str(libraries) + '\n') + f.write('packages = ' + str(packages)) f.close() update_components(docdir) diff --git a/eventchn/Makefile b/eventchn/Makefile index dbe96d0..34359e4 100644 --- a/eventchn/Makefile +++ b/eventchn/Makefile @@ -63,7 +63,7 @@ uninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "eventchn" "library" "$(OBJS)" "." "" "" + python ../doc/doc.py $(DOCDIR) "eventchn" "package" "$(OBJS)" "." "" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) diff --git a/http-svr/Makefile b/http-svr/Makefile index 0b2f214..6867aab 100644 --- a/http-svr/Makefile +++ b/http-svr/Makefile @@ -56,7 +56,7 @@ uninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "http-svr" "library" "$(OBJS)" "." "log,stdext" "" + python ../doc/doc.py $(DOCDIR) "http-svr" "package" "$(OBJS)" "." "log,stdext" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) diff --git a/log/Makefile b/log/Makefile index 22570d9..48eb7c8 100644 --- a/log/Makefile +++ b/log/Makefile @@ -70,7 +70,7 @@ uninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "log" "library" "$(OBJS)" "." "stdext" "" + python ../doc/doc.py $(DOCDIR) "log" "package" "$(OBJS)" "." "stdext" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) diff --git a/mmap/Makefile b/mmap/Makefile index 2bc1d7e..8701f3f 100644 --- a/mmap/Makefile +++ b/mmap/Makefile @@ -63,7 +63,7 @@ uninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "mmap" "library" "$(OBJS)" "." "" "" + python ../doc/doc.py $(DOCDIR) "mmap" "package" "$(OBJS)" "." "" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) diff --git a/pciutil/Makefile b/pciutil/Makefile index 7813e8e..1997625 100644 --- a/pciutil/Makefile +++ b/pciutil/Makefile @@ -72,7 +72,7 @@ binuninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "pciutil" "library" "$(OBJS)" "." "stdext" "" + python ../doc/doc.py $(DOCDIR) "pciutil" "package" "$(OBJS)" "." "stdext" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) diff --git a/rpc-light/Makefile b/rpc-light/Makefile index 5dc5e3b..6e53f5f 100644 --- a/rpc-light/Makefile +++ b/rpc-light/Makefile @@ -73,7 +73,7 @@ uninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "rpc-light" "library" "jsonrpc pa_rpc rpc xmlrpc" "." "xmlm" "" + python ../doc/doc.py $(DOCDIR) "rpc-light" "package" "jsonrpc pa_rpc rpc xmlrpc" "." "xmlm" "" clean: rm -f *.cmo *.cmx *.cma *.cmxa *.annot *.o *.cmi *.a diff --git a/rss/Makefile b/rss/Makefile index d389816..5260e74 100644 --- a/rss/Makefile +++ b/rss/Makefile @@ -56,7 +56,7 @@ uninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "rss" "library" "$(OBJS)" "." "xml-light2" "" + python ../doc/doc.py $(DOCDIR) "rss" "package" "$(OBJS)" "." "xml-light2" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) diff --git a/sexpr/Makefile b/sexpr/Makefile index 3af4d08..2536295 100644 --- a/sexpr/Makefile +++ b/sexpr/Makefile @@ -86,7 +86,7 @@ binuninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "sexpr" "library" "$(OBJS)" "." "stdext" "" + python ../doc/doc.py $(DOCDIR) "sexpr" "package" "$(OBJS)" "." "stdext" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot sExprLexer.ml{,i} sExprParser.ml{,i} $(LIBS) $(PROGRAMS) diff --git a/stdext/Makefile b/stdext/Makefile index 01b19d7..ab94abf 100644 --- a/stdext/Makefile +++ b/stdext/Makefile @@ -117,7 +117,7 @@ binuninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "stdext" "library" "$(STDEXT_OBJS)" "." "threads,uuid,unix" "" + python ../doc/doc.py $(DOCDIR) "stdext" "package" "$(STDEXT_OBJS)" "." "threads,uuid,unix" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) diff --git a/stunnel/Makefile b/stunnel/Makefile index 8e5b465..3dc049d 100644 --- a/stunnel/Makefile +++ b/stunnel/Makefile @@ -56,7 +56,7 @@ uninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "stunnel" "library" "$(OBJS)" "." "stdext,log" "" + python ../doc/doc.py $(DOCDIR) "stunnel" "package" "$(OBJS)" "." "stdext,log" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) diff --git a/uuid/Makefile b/uuid/Makefile index 443a5a2..0e273d0 100644 --- a/uuid/Makefile +++ b/uuid/Makefile @@ -56,7 +56,7 @@ uninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "uuid" "library" "$(OBJS)" "." "" "" + python ../doc/doc.py $(DOCDIR) "uuid" "package" "$(OBJS)" "." "" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) diff --git a/xb/Makefile b/xb/Makefile index b34f6f1..3707e1b 100644 --- a/xb/Makefile +++ b/xb/Makefile @@ -69,7 +69,7 @@ uninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "xb" "library" "$(OBJS)" "." "mmap" "" + python ../doc/doc.py $(DOCDIR) "xb" "package" "$(OBJS)" "." "mmap" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) diff --git a/xc/Makefile b/xc/Makefile index 4ef96d6..24eba32 100644 --- a/xc/Makefile +++ b/xc/Makefile @@ -63,7 +63,7 @@ uninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "xc" "library" "$(OBJS)" "." "mmap,uuid" "" + python ../doc/doc.py $(DOCDIR) "xc" "package" "$(OBJS)" "." "mmap,uuid" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) $(INTF) diff --git a/xml-light2/Makefile b/xml-light2/Makefile index b61638c..d45c8ae 100644 --- a/xml-light2/Makefile +++ b/xml-light2/Makefile @@ -77,7 +77,7 @@ binuninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "xml-light2" "library" "$(OBJS)" "." "stdext,xmlm" "" + python ../doc/doc.py $(DOCDIR) "xml-light2" "package" "$(OBJS)" "." "stdext,xmlm" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) diff --git a/xs/Makefile b/xs/Makefile index 34ba49b..74086d0 100644 --- a/xs/Makefile +++ b/xs/Makefile @@ -59,7 +59,7 @@ uninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "xs" "library" "$(OBJS)" "." "xb" "" + python ../doc/doc.py $(DOCDIR) "xs" "package" "$(OBJS)" "." "xb" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) diff --git a/xsrpc/Makefile b/xsrpc/Makefile index 0437fb2..0d9e9da 100644 --- a/xsrpc/Makefile +++ b/xsrpc/Makefile @@ -56,7 +56,7 @@ uninstall: .PHONY: doc doc: $(INTF) - python ../doc/doc.py $(DOCDIR) "xsrpc" "library" "$(OBJS)" "." "xb,xs" "" + python ../doc/doc.py $(DOCDIR) "xsrpc" "package" "$(OBJS)" "." "xb,xs" "" clean: rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot META $(LIBS) $(PROGRAMS)