コード例 #1
0
""""""

import datetime
import json
import os
import posixpath

from neurodocker import __version__
from neurodocker.interfaces._base import _BaseInterface
from neurodocker.interfaces._base import apt_install
from neurodocker.interfaces._base import yum_install

_installation_implementations = {
    ii._name: ii
    for ii in _BaseInterface.__subclasses__()
}

ND_DIRECTORY = posixpath.join(posixpath.sep, 'neurodocker')
NEURODOCKER_ENTRYPOINT = posixpath.join(ND_DIRECTORY, 'startup.sh')
SPEC_FILE = posixpath.join(ND_DIRECTORY, 'neurodocker_specs.json')

# TODO: add common methods like `--install` here. Reference them in the
# Dockerfile and SingularityRecipe implementation classes.


def _add_to_entrypoint(cmd):
    """Return command to add `cmd` to the container's entrypoint."""
    base_cmd = "sed -i '$i{}' $ND_ENTRYPOINT"
    escaped_bash_cmd = json.dumps(cmd)[1:-1]
    return base_cmd.format(escaped_bash_cmd)
コード例 #2
0
ファイル: common.py プロジェクト: spolex/neurodocker
""""""

import datetime
import json
import posixpath

from neurodocker import __version__
from neurodocker.interfaces._base import _BaseInterface
from neurodocker.interfaces._base import apt_install
from neurodocker.interfaces._base import yum_install

_installation_implementations = {
    ii._name: ii for ii in _BaseInterface.__subclasses__()
}

ND_DIRECTORY = posixpath.join(posixpath.sep, 'neurodocker')
NEURODOCKER_ENTRYPOINT = posixpath.join(ND_DIRECTORY, 'startup.sh')
SPEC_FILE = posixpath.join(ND_DIRECTORY, 'neurodocker_specs.json')

# TODO: add common methods like `--install` here. Reference them in the
# Dockerfile and SingularityRecipe implementation classes.


def _add_to_entrypoint(cmd):
    """Return command to add `cmd` to the container's entrypoint."""
    base_cmd = "sed -i '$i{}' $ND_ENTRYPOINT"
    escaped_bash_cmd = json.dumps(cmd)[1:-1]
    return base_cmd.format(escaped_bash_cmd)


def _apt_install(pkgs, apt_opts=None):