Commit 67176929 authored by Eric  DEVEAUD's avatar Eric DEVEAUD

parser adaptation

parent 3465a4ff
......@@ -333,11 +333,11 @@ def packversion2mongo(pack, version, module_info):
returns a mongo package document
'''
#---- get infos from BIODOCS parsed holder
pack_name = pack['NAME']
pack_name = pack['name']
pack_version, pack_default= version_extract(version)
pack_id = "pack%s%s%s%s" %(ID_SEPARATOR, pack_name, ID_SEPARATOR, pack_version)
pack_htmldocs = pack['HTMLDOCS']
pack_manpages = pack['MANPAGES']
pack_htmldocs = pack['htmldocs']
pack_manpages = pack['manpages']
#---- complement with module info
pack_htmldocs = merge_htmldocs(pack_htmldocs, module_info['htmldocs'])
......@@ -392,14 +392,14 @@ def progs2mongo(pack_name, pack_version, prg_lst, module_info):
#---- 2: add programs in module definitions not documented in BIODOCS
for prog in prg_lst:
prog_name = prog['NAME']
prog_name = prog['name']
# avoid typo documentation
if prog_name.lower() not in provided_prgs:
error(WARN, prog_name, 'not in module', "%s/%s" %(pack_name, pack_version))
continue
provided_prgs.remove(prog_name.lower())
prog_id = "prog%s%s%s%s%s%s" %(ID_SEPARATOR, pack_name, ID_SEPARATOR, pack_version, ID_SEPARATOR, prog_name)
prog_description = ' '.join(prog['DESCRIPTION']).strip()
prog_description = prog['description'] if prog['description'] else ''
mongoprog = mongoprog_creator(prog_id, pack_id, prog_name, prog['HTMLDOCS'], prog['MANPAGES'], prog['CATEGORIES'], prog_description)
ret.append(mongoprog)
#---- insert non documented programs in BIODOCS if some
......@@ -495,11 +495,11 @@ def mobyle2mongo(pack_name, pack_version, prg_lst, module_info):
return ret
def biodocs2mongo(biodocs_pack_info, biodocs_progs_info, mobyle_progs_info):
versions_lst = biodocs_pack_info['VERSION']
pack_name = biodocs_pack_info['NAME']
versions_lst = biodocs_pack_info['version']
pack_name = biodocs_pack_info['name']
for pack_version in versions_lst:
version, _ = version_extract(pack_version)
for version in versions_lst:
#version, _ = version_extract(pack_version)
#---- get info provided by module
module_name = "%s/%s" %(pack_name, version)
......@@ -509,10 +509,10 @@ def biodocs2mongo(biodocs_pack_info, biodocs_progs_info, mobyle_progs_info):
error(WARN, msg)
return
mongoversionpack = packversion2mongo(biodocs_pack_info, pack_version, module_info)
mongoprog_lst = progs2mongo(pack_name, pack_version, biodocs_progs_info, module_info)
mongoversionpack = packversion2mongo(biodocs_pack_info, version, module_info)
mongoprog_lst = progs2mongo(pack_name, version, biodocs_progs_info, module_info)
if "%s/%s" %(pack_name, version) in mobyle_progs_info:
mongomobyle = mobyle2mongo(pack_name, pack_version, biodocs_progs_info, module_info)
mongomobyle = mobyle2mongo(pack_name, version, biodocs_progs_info, module_info)
else:
mongomobyle = []
# iterator on packs definitions
......@@ -609,16 +609,16 @@ if __name__ == '__main__':
db = get_DB(host, port, db_name, j=JOURNALING)
col=db[COL_DEF]
#---- get gensoft -> edam mapping
mapper.update(getMapping('gensoft2edam.mapping'))
#mapper.update(getMapping('gensoft2edam.mapping'))
for biodoc in args:
#pack, progs =BiodocParser.Parser(fh)
pack = BiodocParser.get_packversion(biodoc)
progs = pack['programs']
mongo_pack = pack2mongo(pack)
pprint(mongo_pack)
if cmdline.test:
pprint(mongo_pack)
print mongo_pack.keys()
else:
# first remove any previous entries related to this package
purge_pack(col, pack)
......
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