How to use the hpccm.primitives.copy.copy function in hpccm

To help you get started, we’ve selected a few hpccm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NVIDIA / hpc-container-maker / test / test_copy.py View on Github external
def test_merge_file_singularity(self):
        """merge primitives"""
        c = []
        c.append(copy(src='a', dest='A'))
        c.append(copy(src='b', dest='B'))

        merged = c[0].merge(c)
        self.assertEqual(str(merged), '%files\n    a A\n    b B')
github NVIDIA / hpc-container-maker / test / test_copy.py View on Github external
def test_multiple_docker(self):
        """Multiple source files specified"""
        c = copy(src=['a1', 'a2', 'a3'], dest='b')
        self.assertEqual(str(c), 'COPY a1 \\\n    a2 \\\n    a3 \\\n    b/')
github NVIDIA / hpc-container-maker / test / test_copy.py View on Github external
def test_appfiles_files_singularity(self):
        """Pairs of app-specific files specified"""
        c = copy(files={'a1': 'b1', 'a2': 'b2', 'a3': 'b3'}, _app='foo')
        self.assertEqual(str(c),
                         '%appfiles foo\n    a1 b1\n    a2 b2\n    a3 b3')
github NVIDIA / hpc-container-maker / test / test_copy.py View on Github external
def test_appfiles_multiple_singularity(self):
        """Multiple app-specific source files specified"""
        c = copy(src=['a1', 'a2', 'a3'], dest='b', _app='foo')
        self.assertEqual(str(c),
                         '%appfiles foo\n    a1 b\n    a2 b\n    a3 b')
github NVIDIA / hpc-container-maker / test / test_copy.py View on Github external
def test_invalid_ctype(self):
        """Invalid container type specified"""
        c = copy(src='a', dest='b')
        with self.assertRaises(RuntimeError):
            str(c)
github NVIDIA / hpc-container-maker / test / test_copy.py View on Github external
def test_post_multiple_singularity(self):
        """move file during post"""
        c = copy(src=['a', 'b'], dest='/opt', _post=True)
        self.assertEqual(str(c),
                         '%files\n    a /\n    b /\n%post\n    mv /a /opt/a\n    mv /b /opt/b')
github NVIDIA / hpc-container-maker / test / test_copy.py View on Github external
def test_appfiles_docker(self):
        """app-parameter is ignored in Docker"""
        c = copy(src=['a1', 'a2', 'a3'], dest='b', _app='foo')
        self.assertEqual(str(c), 'COPY a1 \\\n    a2 \\\n    a3 \\\n    b/')
github NVIDIA / hpc-container-maker / hpccm / building_blocks / generic_autotools.py View on Github external
def __instructions(self):
        """Fill in container instructions"""

        if self.__comment:
            if self.url:
                self += comment(self.url, reformat=False)
            elif self.repository:
                self += comment(self.repository, reformat=False)
            elif self.package:
                self += comment(self.package, reformat=False)
        if self.package:
            self += copy(src=self.package,
                         dest=posixpath.join(self.__wd,
                                             os.path.basename(self.package)))
        self += shell(_arguments=self.__run_arguments,
                      commands=self.__commands)
        self += environment(variables=self.environment_step())
        self += label(metadata=self.annotate_step())
github NVIDIA / hpc-container-maker / hpccm / building_blocks / ofed.py View on Github external
```python
        o = ofed(...)
        Stage0 += o
        Stage1 += o.runtime()
        ```
        """
        if self.__prefix:
            self.rt += comment('OFED')

            if self.__deppackages:
                self.rt += packages(ospackages=self.__deppackages)

            # Suppress warnings from libibverbs
            self.rt += shell(commands=['mkdir -p /etc/libibverbs.d'])

            self.rt += copy(_from=_from, dest=self.__prefix, src=self.__prefix)
            return str(self.rt)
        else:
            return str(self)
github NVIDIA / hpc-container-maker / hpccm / building_blocks / nvshmem.py View on Github external
def runtime(self, _from='0'):
        """Generate the set of instructions to install the runtime specific
        components from a build in a previous stage.

        # Examples

        ```python
        n = nvshmem(...)
        Stage0 += n
        Stage1 += n.runtime()
        ```
        """
        self.rt += comment('NVSHMEM')
        if self.__binary_tarball:
            self.rt += copy(_from=_from, src=self.__prefix, dest=self.__prefix)
            self.rt += environment(variables=self.environment_step())
        else:
            self.rt += self.__bb.runtime(_from=_from)
        return str(self.rt)