Commit 5ee60840 authored by Dion Haefner's avatar Dion Haefner

fixed python 2 support

parent a2363ddd
function(install_python_package curdir packagelist)
message(STATUS "Installing python package dorie.${curdir}")
dune_install_python_package(PATH ${curdir} ADDITIONAL_PIP_PARAMS "-r ${CMAKE_CURRENT_SOURCE_DIR}/${curdir}/requirements.txt -q")
dune_install_python_package(PATH ${curdir} ADDITIONAL_PIP_PARAMS -r ${CMAKE_CURRENT_SOURCE_DIR}/${curdir}/requirements.txt -q)
set(${packagelist} ${${packagelist}} ${CMAKE_CURRENT_SOURCE_DIR}/${curdir} PARENT_SCOPE)
from __future__ import absolute_import
import os
from warnings import warn
from __future__ import absolute_import
import xml.etree.ElementTree as ET
from warnings import warn
from collections import OrderedDict
......@@ -2,6 +2,7 @@ import os
import sys
import warnings
import argparse
import traceback
from dorie.parscraper import readers, writers, match_parameters
from dorie.parscraper.warnings import OutputWarning
......@@ -45,6 +46,9 @@ def scrape(xml_file,source_folder,out,css=None,debug=False):
warnings.warn("Output failed for file {0} with error:\n{1}".format(o,repr(e)), OutputWarning)
if debug:
exc_type, exc_value, exc_traceback = sys.exc_info()
traceback.print_exception(exc_type, exc_value, exc_traceback)
warnings.warn("Unknown output format: .{}. Skipping output".format(file_suffix), OutputWarning)
from __future__ import unicode_literals
import datetime
import os
import re
from __future__ import unicode_literals
import datetime
import os
import re
from __future__ import unicode_literals
import datetime
import os
import re
str = unicode
except NameError:
from dorie.utilities.check_path import check_path
from dorie.parscraper.parameter import Parameter
......@@ -35,10 +42,10 @@ def write(parameters,out,path_base,*args,**kwargs):
with open(out,"w") as output:
rst_document = _format_rst(parameters, headings, widths, table_content)
def _format_rst(parameters,headers,widths,content_function):
rst = ""
rst = u""
for category in parameters:
rst += _format_heading(category)
table_content = [content_function(p) for p in parameters[category]]
......@@ -49,7 +56,7 @@ def _format_table(content,headers,widths):
tab = " "
delimiter = ","
table = ""
table = u""
table += ".. csv-table::\n"
table += tab + ":header: {}\n".format(", ".join(headers))
table += tab + ":delim: {}\n".format(delimiter)
......@@ -72,15 +79,6 @@ def _format_heading(text):
sep = "+"*len(text)
return text + "\n" + sep + "\n\n"
def _format_footer():
tab = " "
footer = ""
footer += ".. class:: center"
footer += tab + "Automatically created by the :mod:`DORiE parameter scraper <dorie.parscraper>`\n\n"
footer += tab + "{0:%d-%m-%Y, %H:%M}".format(
return footer
def _sources(p,path_base):
Assembles the cell text for the sources of a parameter. Since the
......@@ -9,7 +9,7 @@ Script invoking the parameter scraper on a folder given via command line.
if __name__ == "__main__":
try: # catch all exceptions we we can output an error message
try: # catch all exceptions so we can output an error message
with warnings.catch_warnings(record=True) as warn: # catch all warnings so we can count them
parser = argparse.ArgumentParser()
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