コード例 #1
0
    def test_defaults_centos(self):
        """Default python building block"""
        p = python()
        self.assertEqual(
            str(p), r'''# Python
RUN yum install -y \
        python2 \
        python3 && \
    rm -rf /var/cache/yum/*''')
コード例 #2
0
ファイル: ogs_base.py プロジェクト: ufz/ogs-container-maker
    def runtime(self, _from='0'):
        p = python(devel=True, python2=False)
        instructions = [
            comment(__doc__, reformat=False),
            p.runtime(),
            shell(commands=['mkdir -p /apps /scratch /lustre /work /projects'])
        ]

        return '\n'.join(str(x) for x in instructions)
コード例 #3
0
    def test_defaults_alternatives(self):
        """Default python building block"""
        p = python(alternatives=True)
        self.assertEqual(
            str(p), r'''# Python
RUN yum install -y \
        python2 \
        python3 && \
    rm -rf /var/cache/yum/*
RUN alternatives --set python /usr/bin/python2''')
コード例 #4
0
    def test_defaults_ubuntu(self):
        """Default python building block"""
        p = python()
        self.assertEqual(
            str(p), r'''# Python
RUN apt-get update -y && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        python \
        python3 && \
    rm -rf /var/lib/apt/lists/*''')
コード例 #5
0
    def test_runtime(self):
        """Runtime"""
        p = python()
        r = p.runtime()
        self.assertEqual(
            r, r'''# Python
RUN apt-get update -y && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        python \
        python3 && \
    rm -rf /var/lib/apt/lists/*''')
コード例 #6
0
    def test_devel(self):
        """devel option"""
        p = python(devel=True)
        self.assertEqual(
            str(p), r'''# Python
RUN apt-get update -y && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        python \
        python-dev \
        python3 \
        python3-dev && \
    rm -rf /var/lib/apt/lists/*''')
コード例 #7
0
    def test_building_block_singularity(self):
        """test building block"""
        s = scif(name='foo')
        s += [python()]  # list not required, but tests a code branch
        self.assertEqual(
            str(s), r'''%apphelp foo
Python
%appinstall foo
    yum install -y \
        python2 \
        python3
    rm -rf /var/cache/yum/*''')
コード例 #8
0
ファイル: ogs_base.py プロジェクト: ufz/ogs-container-maker
 def __instructions(self):
     """String representation of the building block"""
     self += comment(__doc__, reformat=False)
     self += python(devel=True, python2=False)
     self += pip(pip='pip3',
                 packages=['virtualenv', 'pre-commit', 'cmake-format'])
     self += packages(ospackages=self.__ospackages,
                      apt_ppas=['ppa:git-core/ppa'],
                      epel=True)
     self += shell(commands=self.__commands)
     self += environment(variables={
         'CMAKE_GENERATOR': 'Ninja',
         'PATH': '/usr/local/poetry/bin:$PATH'
     })
コード例 #9
0
    def test_building_block_singularity(self):
        """test building block"""
        s = scif(name='foo')
        s += [python()]  # list not required, but tests a code branch
        self.assertEqual(
            str(s), r'''%apphelp foo
Python
%appinstall foo
    for f in /.singularity.d/env/*; do . $f; done
    yum install -y \
        python2 \
        python3
    rm -rf /var/cache/yum/*
%apprun foo
    eval "if [[ $# -eq 0 ]]; then exec /bin/bash; else exec $@; fi"''')