Commit dd95a061 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

doc.py: generates an index

parent 9fda3fd1
...@@ -10,16 +10,30 @@ DOC = Path('/net/pongo/vol/vol_projects/partage_gepetto/Doc') ...@@ -10,16 +10,30 @@ DOC = Path('/net/pongo/vol/vol_projects/partage_gepetto/Doc')
GITLAB = 'https://gepgitlab.laas.fr' GITLAB = 'https://gepgitlab.laas.fr'
RAINBOARD = 'http://rainboard.laas.fr' RAINBOARD = 'http://rainboard.laas.fr'
VERSION = '16.04' VERSION = '16.04'
INDEX = DOC / 'index.html'
HEAD = DOC / 'index.head.html'
if __name__ == '__main__': if __name__ == '__main__':
for project, namespace, branch in requests.get(f'{RAINBOARD}/doc').json()['ret']: with INDEX.open('w') as f:
with HEAD.open() as head:
f.write(head.read())
for project, namespace, branch in sorted(requests.get(f'{RAINBOARD}/doc').json()['ret']):
url = f'{GITLAB}/{namespace}/{project}/-/jobs/artifacts/{branch}/download' url = f'{GITLAB}/{namespace}/{project}/-/jobs/artifacts/{branch}/download'
path = DOC / namespace / project / branch
r = requests.get(url, {'job': f'robotpkg-{project}-{VERSION}'}, stream=True) r = requests.get(url, {'job': f'robotpkg-{project}-{VERSION}'}, stream=True)
try: try:
z = ZipFile(BytesIO(r.content)) z = ZipFile(BytesIO(r.content))
path = DOC / namespace / project / branch
path.mkdir(parents=True, exist_ok=True) path.mkdir(parents=True, exist_ok=True)
z.extractall(str(path)) z.extractall(str(path))
except BadZipFile: except BadZipFile:
continue pass
if path.exists():
with INDEX.open('a') as f:
link = path.relative_to(DOC)
print(f'<tr><td>{project}</td><td>{namespace}</td><td><a href="{link}">{branch}</a></td></tr>', file=f)
with INDEX.open('a') as f:
print('</table></body></html>', file=f)
Supports Markdown
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