From b1d458d57e1b8685dad284a32c71404bbfbc17f4 Mon Sep 17 00:00:00 2001 From: Sebastian Gode Date: Wed, 18 Dec 2024 09:14:27 +0000 Subject: [PATCH] modified tox for bindeps --- doc/source/_templates/longtable.tex.jinja | 84 ----------------------- tox.ini | 51 +++++++++++--- 2 files changed, 43 insertions(+), 92 deletions(-) delete mode 100644 doc/source/_templates/longtable.tex.jinja diff --git a/doc/source/_templates/longtable.tex.jinja b/doc/source/_templates/longtable.tex.jinja deleted file mode 100644 index a27f46f5..00000000 --- a/doc/source/_templates/longtable.tex.jinja +++ /dev/null @@ -1,84 +0,0 @@ -\begin{savenotes} -\sphinxatlongtablestart -\sphinxthistablewithglobalstyle -<% if 'booktabs' in table.styles -%> -\sphinxthistablewithbooktabsstyle -<% endif -%> -<% if 'borderless' in table.styles -%> -\sphinxthistablewithborderlessstyle -<% endif -%> -<% if 'standard' in table.styles -%> -\sphinxthistablewithstandardstyle -<% endif -%> -<% if 'vlines' in table.styles -%> -\sphinxthistablewithvlinesstyle -<% endif -%> -<% if 'novlines' in table.styles -%> -\sphinxthistablewithnovlinesstyle -<% endif -%> -<% if 'colorrows' in table.styles -%> -\sphinxthistablewithcolorrowsstyle -<% endif -%> -<% if 'nocolorrows' in table.styles -%> -\sphinxthistablewithnocolorrowsstyle -<% endif -%> -\makeatletter -<%- if table.align == 'default' %> - \LTleft 0cm - \LTright 0cm -<%- elif table.align == 'center' %> - \LTleft \@totalleftmargin plus1fill - \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill -<%- elif table.align == 'left' %> - \LTleft \@totalleftmargin - \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill -<%- elif table.align == 'right' %> - \LTleft \@totalleftmargin plus1fill - \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax -<%- endif %> -\makeatother -<% set total_width = table.colwidths|sum %> -<% set colspec_parts = [] %> -<% for width in table.colwidths %> - <% set part = 'p{{{:.4f}\\textwidth}}'.format((width * 0.863) / total_width) %> - <% set colspec_parts = colspec_parts.append(part) %> -<% endfor %> -<% set colspec_string = ''.join(colspec_parts) %> -\begin{longtable}{<%= colspec_string %>} -<%- if table.caption -%> -\sphinxthelongtablecaptionisattop -\caption{<%= ''.join(table.caption) %>\strut}<%= labels %>\\*[\sphinxlongtablecapskipadjust] -<% elif labels -%> -\noalign{\phantomsection<%= labels %>}% -<% endif -%> -\sphinxtoprule -<%= ''.join(table.header) -%> -<%- if table.header -%> -\sphinxmidrule -<% endif -%> -\endfirsthead - -\multicolumn{<%= table.colcount %>}{c}{\sphinxnorowcolor - \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} <%= _('continued from previous page') %>}}% -}\\ -\sphinxtoprule -<%= ''.join(table.header) -%> -<%- if table.header -%> -\sphinxmidrule -<% endif -%> -\endhead - -\sphinxbottomrule -\multicolumn{<%= table.colcount %>}{r}{\sphinxnorowcolor - \makebox[0pt][r]{\sphinxtablecontinued{<%= _('continues on next page') %>}}% -}\\ -\endfoot - -\endlastfoot -\sphinxtableatstartofbodyhook -<%= ''.join(table.body) -%> -\sphinxbottomrule -\end{longtable} -\sphinxtableafterendhook -\sphinxatlongtableend -\end{savenotes} \ No newline at end of file diff --git a/tox.ini b/tox.ini index 687b8d88..722288d1 100644 --- a/tox.ini +++ b/tox.ini @@ -52,18 +52,53 @@ commands = [testenv:pdf-docs] envdir = {toxworkdir}/docs +allowlist_externals = + rm + mkdir + wget + make + bash + cp +commands = + mkdir -p doc/build/pdf + {[testenv:bindeps]commands} + mkdir -p {toxinidir}/_templates + wget -O {toxinidir}/_templates/longtable.tex.jinja https://gitea.eco.tsi-dev.otc-service.com/infra/docs-templates/raw/branch/main/templates/longtable.tex.jinja + wget -O {toxinidir}/_templates/tabular.tex.jinja https://gitea.eco.tsi-dev.otc-service.com/infra/docs-templates/raw/branch/main/templates/tabular.tex.jinja + wget -O {toxinidir}/_templates/tabulary.tex.jinja https://gitea.eco.tsi-dev.otc-service.com/infra/docs-templates/raw/branch/main/templates/tabulary.tex.jinja + {[testenv:doc-pdf-docs]commands} + +# PDF version +[testenv:doc-pdf-docs] +deps = {[testenv:docs]deps} +allowlist_externals = + rm + mkdir + make + bash + cp commands = rm -rf doc/build/pdf - sphinx-build -a -E -W -b latex doc/source doc/build/pdf + cp -r {toxinidir}/_templates doc/source/_templates/ + sphinx-build -W --keep-going -b latex doc/source doc/build/pdf/ + bash -c "for f in doc/build/pdf/*.gif; do convert $f $\{f/%gif/png\}; done || true" + bash -c "for f in doc/build/pdf/*.tex; do sed -iorig 's/\.gif//g' $f; done" make -C doc/build/pdf -[testenv:bindep] -# Do not install any requirements. We want this to be fast and work even if -# system dependencies are missing, since it's used to tell you what system -# dependencies are missing! This also means that bindep must be installed -# separately, outside of the requirements files. -deps = bindep -commands = bindep test +[testenv:bindeps] +deps = + bindep +allowlist_externals = + wget + rm + bash +commands = + rm -rf {toxinidir}/bindep.txt + rm -rf {toxinidir}/packages.txt + wget -O {toxinidir}/bindep.txt https://raw.githubusercontent.com/opentelekomcloud/otcdocstheme/main/bindep.txt + bash -c "bindep test -b -f {toxinidir}/bindep.txt > {toxinidir}/packages.txt || true" + bash -c 'if [ -s {toxinidir}/packages.txt ]; then if command -v apt &>/dev/null; then apt update && xargs apt install --no-install-recommends -y < {toxinidir}/packages.txt; fi; fi' + bash -c 'if [ -s {toxinidir}/packages.txt ]; then if command -v dnf &>/dev/null; then dnf install -y $(cat {toxinidir}/packages.txt); fi; fi' [flake8] exclude=.venv,.git,.tox,dist,doc,api-ref,*lib/python*,*egg,tools