Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The client here will eventually be released as "spython" (and eventually to
singularity on pypi), and the versions here will coincide with these releases.

## [master](https://github.com/singularityhub/singularity-cli/tree/master)
- WORKDIR should create container for Singularity converter (0.0.12)
- support for background process with client run (0.2.11)
- parser bugfixes, arg from Docker not properly parsed (0.2.1)
- version checks removed to support Singularity 3.x and above (0.2.0)
Expand Down
2 changes: 1 addition & 1 deletion spython/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@


import argparse
import sys
import os
import sys


def get_parser():
Expand Down
11 changes: 5 additions & 6 deletions spython/client/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
# Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

from spython.main.parse.writers import get_writer
from spython.main.parse.parsers import get_parser
import json
import os
import sys

from spython.logger import bot
from spython.main.parse.parsers import get_parser
from spython.main.parse.writers import get_writer
from spython.utils import write_file, write_json

import json
import sys
import os


def main(args, options, parser):
"""This function serves as a wrapper around the DockerParser,
Expand Down
3 changes: 1 addition & 2 deletions spython/client/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ def prepare_client(image):
"""prepare a client to embed in a shell with recipe parsers and writers."""
# The client will announce itself (backend/database) unless it's get
from spython.main import get_client
from spython.main.parse import parsers
from spython.main.parse import writers
from spython.main.parse import parsers, writers

client = get_client()

Expand Down
1 change: 1 addition & 0 deletions spython/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import hashlib
import os

from spython.logger import bot
from spython.utils import split_uri

Expand Down
5 changes: 3 additions & 2 deletions spython/instance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
# Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

from spython.utils.fileio import read_file
from spython.image import ImageBase
import os

from spython.image import ImageBase
from spython.utils.fileio import read_file


class Instance(ImageBase):
def __init__(self, image, start=True, name=None, quiet=True, **kwargs):
Expand Down
8 changes: 4 additions & 4 deletions spython/instance/cmd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ def generate_instance_commands():
"""
from spython.instance import Instance

# run_command uses run_cmd, but wraps to catch error
from spython.main.base.command import init_command, run_command
from spython.main.base.generate import RobotNamer
from spython.main.base.logger import println
from spython.main.instances import list_instances
from spython.utils import run_command as run_cmd

# run_command uses run_cmd, but wraps to catch error
from spython.main.base.command import init_command, run_command
from spython.main.base.generate import RobotNamer
from .logs import _logs, error_logs, output_logs
from .start import start
from .stop import stop
from .logs import error_logs, output_logs, _logs

Instance.RobotNamer = RobotNamer()
Instance._init_command = init_command
Expand Down
7 changes: 4 additions & 3 deletions spython/instance/cmd/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.


from spython.utils import get_userhome, get_username
from spython.logger import bot
import platform
import os
import platform

from spython.logger import bot
from spython.utils import get_userhome, get_username


def error_logs(self, print_logs=False):
Expand Down
2 changes: 1 addition & 1 deletion spython/instance/cmd/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def start(
singularity [...] instance.start [...] <container path> <instance name>

"""
from spython.utils import run_command, check_install
from spython.utils import check_install, run_command

check_install()

Expand Down
4 changes: 3 additions & 1 deletion spython/logger/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

import os
import sys
from .spinner import Spinner

from spython.logger import decodeUtf8String

from .spinner import Spinner

ABORT = -5
CRITICAL = -4
ERROR = -3
Expand Down
2 changes: 1 addition & 1 deletion spython/logger/spinner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@


import sys
import time
import threading
import time
from random import choice


Expand Down
4 changes: 2 additions & 2 deletions spython/main/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ def get_client(quiet=False, debug=False):
from .apps import apps
from .build import build
from .execute import execute, shell
from .export import export
from .help import helpcmd
from .inspect import inspect
from .instances import list_instances, stopall # global instance commands
from .run import run
from .pull import pull
from .export import export
from .run import run

# Actions
client.apps = apps
Expand Down
4 changes: 2 additions & 2 deletions spython/main/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

from .command import generate_bind_list, init_command, run_command
from .flags import parse_verbosity
from .sutils import get_uri, load, setenv, get_filename
from .logger import println, init_level
from .generate import RobotNamer
from .logger import init_level, println
from .sutils import get_filename, get_uri, load, setenv


class Client:
Expand Down
9 changes: 4 additions & 5 deletions spython/main/base/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.


from spython.utils import run_command as run_cmd

from spython.logger import bot

import os
import subprocess
import sys
import os

from spython.logger import bot
from spython.utils import run_command as run_cmd


def init_command(self, action, flags=None):
Expand Down
1 change: 1 addition & 0 deletions spython/main/base/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@


import os

from spython.logger import decodeUtf8String


Expand Down
3 changes: 2 additions & 1 deletion spython/main/base/sutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.


from spython.logger import bot
import os
import re

from spython.logger import bot


def load(self, image=None):
"""load an image, either an actual path on the filesystem or a uri.
Expand Down
5 changes: 3 additions & 2 deletions spython/main/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.


import os
import re

from spython.logger import bot
from spython.utils import stream_command
import re
import os


def build(
Expand Down
4 changes: 2 additions & 2 deletions spython/main/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.


import os

from spython.logger import bot
from spython.utils import stream_command, which

import os


def execute(
self,
Expand Down
3 changes: 2 additions & 1 deletion spython/main/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.


from spython.logger import bot
import os

from spython.logger import bot


def export(
self,
Expand Down
2 changes: 1 addition & 1 deletion spython/main/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

import json as jsonp
from spython.logger import bot

from spython.logger import bot
from spython.utils import check_install, run_command


Expand Down
3 changes: 2 additions & 1 deletion spython/main/instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.


import json

from spython.logger import bot
from spython.utils import run_command
import json


def list_instances(
Expand Down
3 changes: 2 additions & 1 deletion spython/main/parse/parsers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

import abc
from copy import deepcopy
import os
import re
from copy import deepcopy

from spython.logger import bot
from spython.utils import read_file

from ..recipe import Recipe


Expand Down
3 changes: 3 additions & 0 deletions spython/main/parse/parsers/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import re

from spython.logger import bot

from .base import ParserBase


Expand Down Expand Up @@ -425,6 +426,8 @@ def _workdir(self, line):
"""
# Save the last working directory to add to the runscript
workdir = self._setup("WORKDIR", line)
workdir_mkdir = "mkdir -p %s" % ("".join(workdir))
self.recipe[self.active_layer].install.append(workdir_mkdir)
workdir_cd = "cd %s" % ("".join(workdir))
self.recipe[self.active_layer].install.append(workdir_cd)
self.recipe[self.active_layer].workdir = workdir[0]
Expand Down
1 change: 1 addition & 0 deletions spython/main/parse/parsers/singularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import re

from spython.logger import bot

from .base import ParserBase


Expand Down
1 change: 1 addition & 0 deletions spython/main/parse/writers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import os
import tempfile

from spython.logger import bot
from spython.utils import write_file

Expand Down
1 change: 1 addition & 0 deletions spython/main/parse/writers/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@


import re

from spython.logger import bot

from .base import WriterBase
Expand Down
1 change: 1 addition & 0 deletions spython/main/parse/writers/singularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@


import re

from spython.logger import bot

from .base import WriterBase
Expand Down
5 changes: 3 additions & 2 deletions spython/main/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.


from spython.logger import bot
from spython.utils import stream_command, ScopedEnvVar
import os
import re

from spython.logger import bot
from spython.utils import ScopedEnvVar, stream_command


def pull(
self,
Expand Down
3 changes: 2 additions & 1 deletion spython/main/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.


import json

from spython.logger import bot
from spython.utils import stream_command
import json


def run(
Expand Down
11 changes: 5 additions & 6 deletions spython/oci/cmd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@ def generate_oci_commands():
"""The oci command group will allow interaction with an image using
OCI commands.
"""
from spython.oci import OciImage

from spython.main.base.logger import println

# run_command uses run_cmd, but wraps to catch error
from spython.main.base.command import run_command, send_command
from spython.main.base.generate import RobotNamer
from spython.main.base.logger import println
from spython.oci import OciImage

from .actions import _run, attach, create, delete, execute, run, update

# Oci Command Groups
from .mounts import mount, umount
from .states import kill, state, start, pause, resume, _state_command
from .actions import attach, create, delete, execute, run, _run, update
from .states import _state_command, kill, pause, resume, start, state

# Oci Commands
OciImage.start = start
Expand Down
3 changes: 2 additions & 1 deletion spython/oci/cmd/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
# Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

import os

from spython.logger import bot
from spython.utils import stream_command
import os


def run(
Expand Down
Loading