Feat: dockerfile to test bopytex in new environment

This commit is contained in:
Bertrand Benjamin 2022-05-08 09:15:13 +02:00
parent 8f1d9cb4d4
commit 78f6ddc813
4 changed files with 36 additions and 22 deletions

View File

@ -1,6 +1,9 @@
FROM python:3.11-rc-alpine3.14
FROM python:3.11-rc-slim
RUN apk add --no-cache --virtual python3-dev
RUN apt-get update
RUN apt-get install -y texlive texlive-extra-utils
RUN apt-get install -y python3-dev
COPY requirements.txt /tmp/
RUN pip install -r /tmp/requirements.txt
@ -8,8 +11,6 @@ RUN mkdir -p /src/bopytex
COPY bopytex/ /src/bopytex
COPY setup.py /src/
RUN pip install -e /src
COPY example /example
WORKDIR /example
CMD bopytex -n 2 tpl_example.tex

View File

@ -2,6 +2,7 @@ import subprocess
from bopytex.message import Message, SubprocessMessage
def pdfjam(args: dict, deps, output):
joining_process = subprocess.Popen(
["pdfjam"] + deps + ["-o", output],
@ -9,10 +10,24 @@ def pdfjam(args: dict, deps, output):
stderr=subprocess.PIPE,
universal_newlines=True,
)
#return SubprocessMessage(joining_process)
return Message(
joining_process.wait(),
list(joining_process.stdout),
list(joining_process.stderr),
)
def gs(args: dict, deps, output):
""" Not working. The command works in terminal but not here """
joining_process = subprocess.Popen(
["gs", f"-dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile={output}"]
+ deps,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
)
return Message(
joining_process.wait(),
list(joining_process.stdout),
list(joining_process.stderr),
)

View File

@ -4,19 +4,17 @@
from setuptools import setup
setup(
name='Bopytex',
version='0.2',
description='Command line tool for compiling latex with python command embedded',
author='Benjamin Bertrand',
author_email='programming@opytex.org',
packages=['bopytex'],
name="Bopytex",
version="0.9",
description="Command line tool for compiling latex with python command embedded",
author="Benjamin Bertrand",
author_email="benjamin.bertrand@opytex.org",
packages=["bopytex"],
install_requires=[
'click',
'jinja2',
"click",
"jinja2",
],
entry_points={
"console_scripts": ['bopytex=bopytex.script:new']
},
entry_points={"console_scripts": ["bopytex=bopytex.script:new"]},
)
# -----------------------------

View File

@ -60,7 +60,7 @@ def test_with_default_planner(template_path, jinja2_env, tmp_path):
}
for message in main(**options):
pass
assert message.status == 0
assert Path("joined_source.pdf").exists()