From dd013bac4b4acaac0b2e9265f8dedc7506a519ee Mon Sep 17 00:00:00 2001 From: Vanessasaurus <814322+vsoch@users.noreply.github.com> Date: Fri, 8 Dec 2023 01:23:24 -0700 Subject: [PATCH] fix bug with instance run command (#214) * fix bug with instance run command the incorrect function is exposed for instance.run_command it is missing the self parameter, and so the instance (self) is passed as the command. Signed-off-by: vsoch --- CHANGELOG.md | 1 + setup.py | 11 ----------- spython/__init__.py | 10 ---------- spython/client/__init__.py | 3 +-- spython/client/recipe.py | 2 +- spython/client/shell.py | 2 +- spython/client/test.py | 2 +- spython/image.py | 3 ++- spython/instance/__init__.py | 2 +- spython/instance/cmd/__init__.py | 6 ++---- spython/instance/cmd/logs.py | 2 +- spython/instance/cmd/start.py | 2 +- spython/instance/cmd/stop.py | 2 +- spython/logger/compatibility.py | 2 +- spython/logger/message.py | 3 ++- spython/logger/spinner.py | 3 +-- spython/main/__init__.py | 2 +- spython/main/apps.py | 2 +- spython/main/base/command.py | 2 +- spython/main/build.py | 3 +-- spython/main/execute.py | 3 +-- spython/main/export.py | 3 +-- spython/main/help.py | 2 +- spython/main/inspect.py | 3 ++- spython/main/instances.py | 3 +-- spython/main/pull.py | 3 +-- spython/main/run.py | 3 +-- spython/oci/__init__.py | 3 ++- spython/tests/Xtest_oci.py | 2 +- spython/tests/test_base.py | 2 +- spython/tests/test_client.py | 3 ++- spython/tests/test_conversion.py | 2 +- spython/tests/test_instances.py | 2 +- spython/tests/test_parsers.py | 2 +- spython/tests/test_recipe.py | 2 +- spython/tests/test_utils.py | 2 +- spython/tests/test_writers.py | 2 +- spython/utils/fileio.py | 12 ++++-------- spython/utils/misc.py | 2 +- spython/version.py | 4 ++-- 40 files changed, 48 insertions(+), 77 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9daaa87..0afa2c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) + - bug with instance.run_command (0.3.12) - added check to enbsure stderr exists upon a non-zero return code when streaming (0.3.11) - exposed the stream type option, and ability to capture both stdout and stderr when stream=True (0.3.1) - dropping support for Singularity 2.x (0.3.0) diff --git a/setup.py b/setup.py index 6482d7c..6c29a9a 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,3 @@ -""" - -Copyright (C) 2017-2021 Vanessa Sochat. - -This Source Code Form is subject to the terms of the -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 setuptools import find_packages, setup diff --git a/spython/__init__.py b/spython/__init__.py index 9a8bcdd..374809b 100644 --- a/spython/__init__.py +++ b/spython/__init__.py @@ -1,11 +1 @@ -""" - -Copyright (C) 2017-2022 Vanessa Sochat. - -This Source Code Form is subject to the terms of the -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.version import __version__ diff --git a/spython/client/__init__.py b/spython/client/__init__.py index 26e3c88..ad65491 100644 --- a/spython/client/__init__.py +++ b/spython/client/__init__.py @@ -1,12 +1,11 @@ #!/usr/bin/env python -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # 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 argparse import os import sys diff --git a/spython/client/recipe.py b/spython/client/recipe.py index 7f63c96..f2b3dbd 100644 --- a/spython/client/recipe.py +++ b/spython/client/recipe.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/client/shell.py b/spython/client/shell.py index e57d829..2887dfc 100644 --- a/spython/client/shell.py +++ b/spython/client/shell.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/client/test.py b/spython/client/test.py index 97c8d60..62299e5 100644 --- a/spython/client/test.py +++ b/spython/client/test.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/image.py b/spython/image.py index 4a9b36b..1737ef1 100644 --- a/spython/image.py +++ b/spython/image.py @@ -1,9 +1,10 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # 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 hashlib import os diff --git a/spython/instance/__init__.py b/spython/instance/__init__.py index 275cf34..a0d4dd1 100644 --- a/spython/instance/__init__.py +++ b/spython/instance/__init__.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/instance/cmd/__init__.py b/spython/instance/cmd/__init__.py index 22fdaeb..84bad83 100644 --- a/spython/instance/cmd/__init__.py +++ b/spython/instance/cmd/__init__.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed @@ -18,7 +18,6 @@ def generate_instance_commands(): 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 from .logs import _logs, error_logs, output_logs from .start import start @@ -26,8 +25,7 @@ def generate_instance_commands(): Instance.RobotNamer = RobotNamer() Instance._init_command = init_command - Instance.run_command = run_cmd - Instance._run_command = run_command + Instance.run_command = run_command Instance._list = list_instances # list command is used to get metadata Instance._println = println Instance.start = start # intended to be called on init, not by user diff --git a/spython/instance/cmd/logs.py b/spython/instance/cmd/logs.py index c407bac..7ab3c3a 100644 --- a/spython/instance/cmd/logs.py +++ b/spython/instance/cmd/logs.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/instance/cmd/start.py b/spython/instance/cmd/start.py index da64346..bb38206 100644 --- a/spython/instance/cmd/start.py +++ b/spython/instance/cmd/start.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/instance/cmd/stop.py b/spython/instance/cmd/stop.py index d4bde8f..b14aa0f 100644 --- a/spython/instance/cmd/stop.py +++ b/spython/instance/cmd/stop.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/logger/compatibility.py b/spython/logger/compatibility.py index bde9692..c0742a3 100644 --- a/spython/logger/compatibility.py +++ b/spython/logger/compatibility.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/logger/message.py b/spython/logger/message.py index b472ab0..7150f53 100644 --- a/spython/logger/message.py +++ b/spython/logger/message.py @@ -1,9 +1,10 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # 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 import sys diff --git a/spython/logger/spinner.py b/spython/logger/spinner.py index 9a200e0..1be88b5 100644 --- a/spython/logger/spinner.py +++ b/spython/logger/spinner.py @@ -1,10 +1,9 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # 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 sys import threading import time diff --git a/spython/main/__init__.py b/spython/main/__init__.py index 88c9fd8..2278bb2 100644 --- a/spython/main/__init__.py +++ b/spython/main/__init__.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/main/apps.py b/spython/main/apps.py index fc304f9..ea523de 100644 --- a/spython/main/apps.py +++ b/spython/main/apps.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/main/base/command.py b/spython/main/base/command.py index 40fe93e..c1c4f4d 100644 --- a/spython/main/base/command.py +++ b/spython/main/base/command.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/main/build.py b/spython/main/build.py index 2753ec8..a19dd4c 100644 --- a/spython/main/build.py +++ b/spython/main/build.py @@ -1,10 +1,9 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # 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 import re diff --git a/spython/main/execute.py b/spython/main/execute.py index fd3654d..7590b1b 100644 --- a/spython/main/execute.py +++ b/spython/main/execute.py @@ -1,10 +1,9 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # 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 import shutil diff --git a/spython/main/export.py b/spython/main/export.py index e912a67..ec64e36 100644 --- a/spython/main/export.py +++ b/spython/main/export.py @@ -1,10 +1,9 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # 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 diff --git a/spython/main/help.py b/spython/main/help.py index 306787a..eff4c6d 100644 --- a/spython/main/help.py +++ b/spython/main/help.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/main/inspect.py b/spython/main/inspect.py index 4ade197..f07da36 100644 --- a/spython/main/inspect.py +++ b/spython/main/inspect.py @@ -1,9 +1,10 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # 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 json as jsonp from spython.logger import bot diff --git a/spython/main/instances.py b/spython/main/instances.py index 573cb56..5725465 100644 --- a/spython/main/instances.py +++ b/spython/main/instances.py @@ -1,10 +1,9 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # 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 json from spython.logger import bot diff --git a/spython/main/pull.py b/spython/main/pull.py index 6ff3e69..c9bcad4 100644 --- a/spython/main/pull.py +++ b/spython/main/pull.py @@ -1,10 +1,9 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # 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 import re diff --git a/spython/main/run.py b/spython/main/run.py index 7350e3e..1299b9f 100644 --- a/spython/main/run.py +++ b/spython/main/run.py @@ -1,10 +1,9 @@ -# Copyright (C) 2017-2021 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # 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 json from spython.logger import bot diff --git a/spython/oci/__init__.py b/spython/oci/__init__.py index 64a0a78..06500e4 100644 --- a/spython/oci/__init__.py +++ b/spython/oci/__init__.py @@ -1,9 +1,10 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # 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.image import ImageBase from spython.logger import bot diff --git a/spython/tests/Xtest_oci.py b/spython/tests/Xtest_oci.py index 4ccf52d..9de6b0d 100644 --- a/spython/tests/Xtest_oci.py +++ b/spython/tests/Xtest_oci.py @@ -1,6 +1,6 @@ #!/usr/bin/python -# Copyright (C) 2020-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/tests/test_base.py b/spython/tests/test_base.py index 73eb296..a8f094a 100644 --- a/spython/tests/test_base.py +++ b/spython/tests/test_base.py @@ -1,6 +1,6 @@ #!/usr/bin/python -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/tests/test_client.py b/spython/tests/test_client.py index 0703a8c..bc1d903 100644 --- a/spython/tests/test_client.py +++ b/spython/tests/test_client.py @@ -1,11 +1,12 @@ #!/usr/bin/python -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # 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 import shutil from subprocess import CalledProcessError diff --git a/spython/tests/test_conversion.py b/spython/tests/test_conversion.py index 37b25f6..d2d3c13 100644 --- a/spython/tests/test_conversion.py +++ b/spython/tests/test_conversion.py @@ -1,6 +1,6 @@ #!/usr/bin/python -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/tests/test_instances.py b/spython/tests/test_instances.py index 3690ed1..79b86d3 100644 --- a/spython/tests/test_instances.py +++ b/spython/tests/test_instances.py @@ -1,6 +1,6 @@ #!/usr/bin/python -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/tests/test_parsers.py b/spython/tests/test_parsers.py index bc90826..eed4a70 100644 --- a/spython/tests/test_parsers.py +++ b/spython/tests/test_parsers.py @@ -1,6 +1,6 @@ #!/usr/bin/python -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/tests/test_recipe.py b/spython/tests/test_recipe.py index bf76a82..0419d2a 100644 --- a/spython/tests/test_recipe.py +++ b/spython/tests/test_recipe.py @@ -1,6 +1,6 @@ #!/usr/bin/python -# Copyright (C) 2019-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/tests/test_utils.py b/spython/tests/test_utils.py index 9d7f9af..c016ece 100644 --- a/spython/tests/test_utils.py +++ b/spython/tests/test_utils.py @@ -1,6 +1,6 @@ #!/usr/bin/python -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/tests/test_writers.py b/spython/tests/test_writers.py index 93ff7f0..a84bdce 100644 --- a/spython/tests/test_writers.py +++ b/spython/tests/test_writers.py @@ -1,6 +1,6 @@ #!/usr/bin/python -# Copyright (C) 2019-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/utils/fileio.py b/spython/utils/fileio.py index ea06147..5a91cc5 100644 --- a/spython/utils/fileio.py +++ b/spython/utils/fileio.py @@ -1,12 +1,8 @@ -""" +# Copyright (C) 2017-2024 Vanessa Sochat. -# Copyright (C) 2017-2022 Vanessa Sochat. - -This Source Code Form is subject to the terms of the -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/. - -""" +# This Source Code Form is subject to the terms of the +# 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 errno import json diff --git a/spython/utils/misc.py b/spython/utils/misc.py index c5f0b35..534f8a6 100644 --- a/spython/utils/misc.py +++ b/spython/utils/misc.py @@ -1,4 +1,4 @@ -# Copyright (C) 2019-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed diff --git a/spython/version.py b/spython/version.py index 100b811..528d02c 100644 --- a/spython/version.py +++ b/spython/version.py @@ -1,11 +1,11 @@ -# Copyright (C) 2017-2022 Vanessa Sochat. +# Copyright (C) 2017-2024 Vanessa Sochat. # This Source Code Form is subject to the terms of the # 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/. -__version__ = "0.3.11" +__version__ = "0.3.12" AUTHOR = "Vanessa Sochat" AUTHOR_EMAIL = "vsoch@users.noreply.github.com" NAME = "spython"