Spaces:
Running
Running
| [buildout] | |
| extends = translator.cfg | |
| components/jxml.cfg | |
| components/xalan-j-2.7.2.cfg | |
| develop+= pyhwp-tests | |
| tools/xsltest | |
| tools/gpl | |
| parts+= test-core | |
| test-coverage | |
| test-cli | |
| test-xsl | |
| test-xsl-cov | |
| test-sdist | |
| test-tools | |
| test-for-bisect | |
| xsltest | |
| code-analysis | |
| collect-samples | |
| masstest-failed | |
| massfind-unknowntag | |
| massfind-incomplete | |
| expected-output-update | |
| [pyhwp] | |
| eggs+= nose | |
| coverage | |
| gpl | |
| pyroma | |
| [test-core] | |
| recipe = collective.xmltestreport | |
| eggs = pyhwp-tests | |
| defaults = ['--auto-color', '--auto-progress', '--xml', '--tests-pattern=hwp5_tests'] | |
| [test-xsl] | |
| recipe = collective.recipe.template | |
| input = ${buildout:directory}/misc/test-xsl.in | |
| output = ${buildout:directory}/bin/test-xsl | |
| mode = 755 | |
| [test-xsl-cov] | |
| recipe = collective.recipe.template | |
| mode=755 | |
| output=${buildout:bin-directory}/test-xsl-cov | |
| input =inline: | |
| #!/bin/sh | |
| CLASSPATH=${xalan-j-2.7.2:jars} ${jxml:location}/bin/jxml-cov-test $* | |
| [test-coverage] | |
| recipe = collective.recipe.template | |
| input = ${buildout:directory}/misc/test-coverage | |
| output = ${buildout:directory}/bin/test-coverage | |
| mode = 755 | |
| [test-cli] | |
| recipe = collective.recipe.template | |
| input = ${buildout:directory}/misc/test-cli.in | |
| output = ${buildout:directory}/bin/test-cli | |
| mode = 755 | |
| [test-sdist] | |
| recipe = collective.recipe.template | |
| input = ${buildout:directory}/misc/test-sdist.in | |
| output = ${buildout:directory}/bin/test-sdist | |
| mode = 755 | |
| [test-tools] | |
| recipe = collective.xmltestreport | |
| eggs = gpl | |
| defaults = ['--auto-color', '--auto-progress', '--xml'] | |
| [test-for-bisect] | |
| recipe = collective.recipe.template | |
| input = ${buildout:directory}/misc/test-for-bisect | |
| output = ${buildout:directory}/bin/test-for-bisect | |
| mode = 755 | |
| [xsltest] | |
| recipe = zc.recipe.egg | |
| eggs = xsltest | |
| [code-analysis] | |
| recipe = plone.recipe.codeanalysis | |
| directory = ${buildout:directory}/pyhwp | |
| # Default is 10 | |
| flake8-max-complexity = 30 | |
| utf8-header = True | |
| [collect-samples] | |
| recipe = collective.recipe.template | |
| mode = 755 | |
| output = ${buildout:bin-directory}/${:_buildout_section_name_} | |
| input = | |
| inline: | |
| #!/bin/sh | |
| set -e | |
| dir="$1" | |
| find "$dir" -iname '*.hwp' -print0 | parallel --gnu -0 "${save-sample:output}" | |
| [save-sample] | |
| recipe = collective.recipe.template | |
| mode = 755 | |
| output = ${buildout:bin-directory}/${:_buildout_section_name_} | |
| input = | |
| inline: | |
| #!/bin/sh | |
| set -e | |
| src="$1" | |
| [ -e "$src" ] || (echo "$src not found"; exit 1) | |
| ${:abspath} | |
| version=$(${buildout:bin-directory}/hwp5proc version "$src") | |
| srcpath=$(abspath "$src") | |
| sha1sum=$(sha1sum -b "$srcpath" | awk '{ print $1 }') | |
| echo "$version/$sha1sum $srcpath" | |
| repo="${buildout:directory}/samples.local" | |
| blob_dir="${buildout:directory}/samples.local/blob" | |
| [ -d "$blob_dir" ] || mkdir -p "$blob_dir" | |
| blob_path="$blob_dir/$sha1sum" | |
| [ -e "$blob_path" ] || cp "$srcpath" "$blob_path" | |
| dst_path="$repo/$version/$sha1sum.hwp" | |
| dst_dir=$(dirname "$dst_path") | |
| [ -d "$dst_dir" ] || mkdir -p "$dst_dir" | |
| [ -e $dst_path ] || ln -s "$blob_path" "$dst_path" | |
| abspath= | |
| abspath() { | |
| if [ $(echo "$1" | head -c 1) = "/" ]; then | |
| echo "$1" | |
| else | |
| echo "$PWD/$1" | |
| fi | |
| } | |
| [masstest-failed] | |
| recipe = collective.recipe.template | |
| mode = 755 | |
| output = ${buildout:bin-directory}/${:_buildout_section_name_} | |
| input = | |
| inline: | |
| #!/bin/sh | |
| set -e | |
| ${masstest:output} "${masstest-worker:failed-dir}" | |
| [masstest] | |
| recipe = collective.recipe.template | |
| mode = 755 | |
| output = ${buildout:bin-directory}/${:_buildout_section_name_} | |
| input = | |
| inline: | |
| #!/bin/sh | |
| set -e | |
| ${:def-masstest} | |
| sample_dir="${buildout:directory}/samples.local/" | |
| [ -z "$1" ] || sample_dir="$1" | |
| masstest "$sample_dir" | tee ${buildout:parts-directory}/masstest.log | |
| def-masstest= | |
| masstest() { | |
| find "$1" -iname '*.hwp' -print0 | parallel --gnu -0 ${masstest-worker:output} | |
| } | |
| [masstest-worker] | |
| recipe = collective.recipe.template | |
| mode = 755 | |
| output = ${buildout:bin-directory}/${:_buildout_section_name_} | |
| input = | |
| inline: | |
| #!/bin/sh | |
| set -e | |
| [ -e "$1" ] || (echo "$1: not found"; exit 1) | |
| testee="$1" | |
| failed_dir="${:failed-dir}" | |
| [ -d "$failed_dir" ] || mkdir -p "$failed_dir" | |
| errors_dir="${:errors-dir}" | |
| [ -d "$errors_dir" ] || mkdir -p "$errors_dir" | |
| testee_filename=$(basename "$testee") | |
| testee_error_hwp5proc="$errors_dir/$testee_filename.hwp5proc.err" | |
| testee_error_xmllint="$errors_dir/$testee_filename.xmllint.err" | |
| test_xml() { | |
| ${buildout:bin-directory}/hwp5proc xml "$testee" 2> "$testee_error_hwp5proc" | xmllint --format - > /dev/null 2> "$testee_error_xmllint" | |
| } | |
| handle_success() { | |
| echo "" | |
| filename=$(basename "$testee") | |
| failed_path="$failed_dir/$filename" | |
| [ ! -e "$failed_path" ] || rm -f "$failed_path" | |
| rm -f "$testee_error_hwp5proc" | |
| rm -f "$testee_error_xmllint" | |
| } | |
| handle_failed() { | |
| echo " FAILED" | |
| [ -e "$failed_path" ] || ln -s "$testee" "$failed_dir" | |
| } | |
| echo -n "$testee" | |
| test_xml && handle_success || handle_failed | |
| failed-dir=${buildout:parts-directory}/masstest/failed | |
| errors-dir=${buildout:parts-directory}/masstest/errors | |
| [massfind-unknowntag] | |
| recipe = collective.recipe.template | |
| output = ${buildout:bin-directory}/${:_buildout_section_name_} | |
| mode = 755 | |
| input = | |
| inline: | |
| #!/bin/sh | |
| set -e | |
| samples='${buildout:directory}/samples.local' | |
| find "$samples/" -iname '*.hwp' | parallel --gnu ${buildout:bin-directory}/hwp5proc find --model=UnknownTagModel | tee ${buildout:parts-directory}/massfind-unknowntag | |
| [massfind-incomplete] | |
| recipe = collective.recipe.template | |
| output = ${buildout:bin-directory}/${:_buildout_section_name_} | |
| mode = 755 | |
| input = | |
| inline: | |
| #!/bin/sh | |
| set -e | |
| samples='${buildout:directory}/samples.local' | |
| find "$samples/" -iname '*.hwp' | parallel --gnu ${buildout:bin-directory}/hwp5proc find --incomplete | tee ${buildout:parts-directory}/massfind-incomplete | |
| [expected-output-update] | |
| recipe = collective.recipe.template | |
| output = ${buildout:bin-directory}/${:_buildout_section_name_} | |
| mode = 755 | |
| input = | |
| inline: | |
| #!/bin/sh | |
| set -e | |
| samples='${buildout:directory}/samples' | |
| find "$samples/" -iname '*.hwp' | parallel --gnu ${expected-output-update-worker:output} | |
| [expected-output-update-worker] | |
| recipe = collective.recipe.template | |
| output = ${buildout:bin-directory}/${:_buildout_section_name_} | |
| mode = 755 | |
| input = | |
| inline: | |
| #!/bin/sh | |
| set -e | |
| filename=$1 | |
| docinfo="$filename.docinfo.json" | |
| section0="$filename.bodytext.section0.json" | |
| xmlformat="$filename.formatted.xml" | |
| odt_output="$filename.odt" | |
| odt_filename=`basename "$odt_output"` | |
| hwp5proc_xml() { | |
| ${buildout:bin-directory}/hwp5proc xml "$1" 2> "$xmlformat.err" | |
| } | |
| hwp5odt() { | |
| local orgdir="$PWD" | |
| local filename=`basename "$1"` | |
| local odt_file=`echo $filename | sed -e "s/.hwp$/.odt/g"` | |
| cd `dirname "$1"` | |
| ${buildout:bin-directory}/hwp5odt "$filename" | |
| rm -rf "$odt_file.d" | |
| mkdir "$odt_file.d" | |
| unzip "$odt_file" -d "$odt_file.d" | |
| rm -f "$odt_file" | |
| cd "$orgdir" | |
| } | |
| hwp5html() { | |
| local html_dir=`echo $1 | sed -e "s/.hwp$/.html.d/g"` | |
| rm -rf "$html_dir" | |
| ${buildout:bin-directory}/hwp5html "$1" --output "$html_dir" | |
| xmllint --c14n --nonet --encode utf-8 "$html_dir/index.xhtml" | xmllint --format --encode utf-8 - > "$html_dir/index.formatted.xhtml" | |
| } | |
| xml_c14n() { | |
| xmllint --c14n --encode utf-8 - 2> "$xmlformat.c14n.err" | |
| } | |
| xml_format() { | |
| xmllint --format --encode utf-8 - 2> "$xmlformat.format.err" | |
| } | |
| if ${buildout:bin-directory}/hwp5proc header "$filename" | grep password | grep 0 > /dev/null; then | |
| dummy='' | |
| else | |
| echo "$filename: SKIPPING" | |
| rm -f "$docinfo.err" | |
| rm -f "$section0.err" | |
| rm -f "$xmlformat.err" | |
| rm -f "$xmlformat.c14n.err" | |
| rm -f "$xmlformat.format.err" | |
| exit 0 | |
| fi | |
| ${buildout:bin-directory}/hwp5proc models "$filename" docinfo > "$docinfo" 2> "$docinfo.err" && echo "$filename: docinfo" && rm -f "$docinfo.err" | |
| ${buildout:bin-directory}/hwp5proc models "$filename" bodytext/0 > "$section0" 2> "$section0.err" && echo "$filename: bodytext/0" && rm -f "$section0.err" | |
| hwp5proc_xml "$filename" | xml_c14n | xml_format > "$xmlformat" && echo "$filename: xml" && rm -f "$xmlformat.err" "$xmlformat.c14n.err" "$xmlformat.format.err" | |
| hwp5odt "$filename" | |
| hwp5html "$filename" | |