Commit aa51d980 authored by Mathieu Haefele's avatar Mathieu Haefele Committed by Matthieu Haefele
Browse files

Supports download implemented

parent 96c91335
......@@ -42,8 +42,148 @@ Journée précision numérique
:class: programme
.. schedule::
:indico_url: https://indico.mathrice.fr/
:indico_event: 166
.. day:: 28-06-2019
.. break_event:: Accueil café
:begin: 09:30
:end: 10:00
.. event:: Arithmétique stochastique synchrone et CADNA
:begin: 10:00
:end: 10:45
:speaker: Fabienne Jézéquel
:support:
[support 1](attachments/evt/2019-06-precision-num/support00.pdf)
.. event:: CADNA for simulation and data assimilation: a user perspective
:begin: 10:45
:end: 11:05
:speaker: Julien Brajard
:support:
[support 1](attachments/evt/2019-06-precision-num/support01.pdf)
.. event:: Conjugate gradient analysis with CADNA for an efficient FPGA implementation
:begin: 11:05
:end: 11:25
:speaker: Matthieu Haefele
:support:
[support 1](attachments/evt/2019-06-precision-num/support02.tgz)
.. break_event:: Pause
:begin: 11:25
:end: 11:40
.. event:: Asynchronous Stochastic Arithmetic
:begin: 11:40
:end: 12:05
:speaker: Eric Petit
:support:
[support 1](attachments/evt/2019-06-precision-num/support03.pdf)
.. event:: Verificarlo: Debugging and optimizing floating point usage in numerical simulations
:begin: 12:05
:end: 12:25
:speaker: Eric Petit
:support:
[support 1](attachments/evt/2019-06-precision-num/support04.pdf)
.. event:: A detailed precision analysis for weather and climate models with Verificarlo
:begin: 12:25
:end: 12:45
:speaker: Peter Dueben
:support:
[support 1](attachments/evt/2019-06-precision-num/support05.pdf)
.. break_event:: Pause déjeuner
:begin: 12:45
:end: 13:55
.. event:: Groupe de Travail ARITH du GdR Informatique Mathématique
:begin: 13:55
:end: 14:00
:speaker: Sylvie Boldo
:support:
[support 1](attachments/evt/2019-06-precision-num/support06.pdf)
.. event:: Verrou : déboguage numérique des codes de calcul industriels
:begin: 14:00
:end: 14:20
:speaker: François Fevotte
:support:
[support 1](attachments/evt/2019-06-precision-num/support07.pdf)
.. event:: Confidence intervals for stochastic arithmetic
:begin: 14:20
:end: 14:40
:speaker: François Fevotte
:support:
[support 1](attachments/evt/2019-06-precision-num/support08.pdf)
.. event:: Floating-point profiling of ACTS with Verrou
:begin: 14:40
:end: 15:00
:speaker: Hadrien Grasland
:support:
[support 1](attachments/evt/2019-06-precision-num/support09.pdf)
.. break_event:: Pause
:begin: 15:00
:end: 15:30
.. event:: Propagation of rounding errors by interval arithmetic and affine forms
:begin: 15:30
:end: 16:15
:speaker: Franck Vedrine
:support:
[support 1](attachments/evt/2019-06-precision-num/support10.pdf)
.. event:: Fluctuat: Verification of accuracy properties of numerical components and synchronous embedded software
:begin: 16:15
:end: 16:35
:speaker: Franck Vedrine
:support:
[support 1](attachments/evt/2019-06-precision-num/support11.pdf) [support 2](attachments/evt/2019-06-precision-num/support12.mp4) [support 3](attachments/evt/2019-06-precision-num/support13.mp4) [support 4](attachments/evt/2019-06-precision-num/support14.mp4)
.. event:: Clôture
:begin: 16:35
:end: 17:00
:speaker: Organisateurs
.. section:: Organisation
......
......@@ -14,12 +14,14 @@ import re
try:
import rst_directives as rd
except ImportError:
cwd = os.getcwd()
l = cwd.split("/")
head = os.getcwd()
head, tail = os.path.split(head)
while tail != 'website' and head != '/' and head != '':
head, tail = os.path.split(head)
print("You have to set up properly your PYTHONPATH:")
if "website" in l:
index = l.index("website")
print("export PYTHONPATH=$PYTHONPATH:%s/plugins"%("/".join(l[:index+1])))
if tail == "website":
print("export PYTHONPATH=$PYTHONPATH:%s/website/plugins"%(head))
else:
print("export PYTHONPATH=$PYTHONPATH:/path_to_website_repo/plugins")
sys.exit(1)
......@@ -56,15 +58,14 @@ def fetch_indico_id(evt_content, l_sched):
return indico_url, indico_event, item
def indent_content(content, indent):
return "\n".join(
" "*indent + line for line in content.splitlines()
)
to_return = ['\n']
for line in content.splitlines():
to_return.append(" "*indent + line + '\n')
return to_return
def gen_rst_evt_with_program(evt_orig):
f = open(evt_orig, "r")
evt_content = f.readlines()
f.close()
def gen_rst_evt_with_program(evt_content):
l_sched, content_indent = fetch_line_schedule(evt_content)
if l_sched < 0:
return ""
......@@ -73,13 +74,84 @@ def gen_rst_evt_with_program(evt_orig):
if url=="" or evt < 0:
print("Error could not find indico_url or indico_event directives")
return ""
prog_to_insert = rd.get_indico_event_as_schedule(url, evt)
prog_to_insert_str = rd.get_indico_event_as_schedule(url, evt)
prog_to_insert = indent_content(prog_to_insert_str, content_indent+4)
return evt_content[:l_sched+1] + prog_to_insert + evt_content[last_line:]
def build_support_dir(evt_orig):
evt_name, rst_ext = os.path.splitext(evt_orig)
evt_name = os.path.basename(evt_name)
head = os.path.abspath(evt_orig)
head, tail = os.path.split(head)
while tail != 'website' and head != '/' and head != '':
head, tail = os.path.split(head)
if tail != "website":
print("Error: Please convert event from the website repository")
sys.exit(1)
return os.path.join(head, 'website', 'content', 'attachments', 'evt', evt_name)
def truncate(dest_dir):
head, tail = os.path.split(dest_dir)
truncated = tail
while tail != 'content' and head != '/' and head != '':
head, tail = os.path.split(head)
if tail != "content":
truncated = os.path.join(tail, truncated)
if tail != "content":
print("Error: Destination directory for supports must be in the content directory")
sys.exit(1)
return truncated
return "".join(evt_content[:l_sched+1]) + "\n" + indent_content(prog_to_insert, content_indent+4) + "".join(evt_content[last_line:])
def write(content_with_prog, evt_to_treat):
def treat_support(line_orig, url_support, dest_dir, support_id):
import urllib.request
response = urllib.request.urlopen(url_support)
content = response.read()
root, ext = os.path.splitext(url_support)
new_support = os.path.join(dest_dir, 'support%02d%s'%(support_id, ext))
f = open(new_support, "wb")
f.write(content)
f.close()
rst_support = os.path.join(truncate(dest_dir), 'support%02d%s'%(support_id, ext))
new_line = line_orig.split('(')[0] + '(' + rst_support + ')'
return new_line, new_support
def fetch_supports(content_with_prog, evt_orig):
dest_dir = build_support_dir(evt_orig)
try:
os.mkdir(dest_dir)
except FileExistsError:
print("Error: Directory %s already exists"%dest_dir)
sys.ext(1)
git_helper_str = "git add \\\n%s \\\n"%evt_orig
support_url_pattern = re.compile("[\s]*\[support [0-9]*\]\(([\W\w0-9/:\.-_]*)\)")
support_id=0
for i, l in enumerate(content_with_prog):
res = support_url_pattern.search(l)
if res != None:
print("Treating %s"%res.group(1))
new_line, new_support = treat_support(l, res.group(1), dest_dir, support_id)
content_with_prog[i] = new_line
git_helper_str += "%s \\\n"%new_support
support_id += 1
return git_helper_str, content_with_prog
def fetch_content(evt_orig):
f = open(evt_orig, "r")
c = f.readlines()
f.close()
return c
def write_content(content_with_prog, evt_to_treat):
f = open(evt_to_treat, "w")
f.write(content_with_prog)
f.write("".join(content_with_prog))
f.close()
if __name__ == "__main__":
......@@ -91,7 +163,10 @@ python3 %s path/to/evt_to_archive.rst"%(sys.argv[0])""")
sys.exit(1)
evt_to_treat = sys.argv[1]
content_with_prog = gen_rst_evt_with_program(evt_to_treat)
write(content_with_prog, evt_to_treat)
evt_content = fetch_content(evt_to_treat)
content_with_prog = gen_rst_evt_with_program(evt_content)
user_msg, prog_to_insert = fetch_supports(content_with_prog, evt_to_treat)
write_content(content_with_prog, evt_to_treat)
print("\nrst file modified and supports downloaded. Please add them to the repository.\n\n%s"%user_msg)
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