Skip to content

Commit

Permalink
more debug
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <[email protected]>
  • Loading branch information
vsoch committed Mar 28, 2024
1 parent f56a7bd commit 085ef57
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
19 changes: 13 additions & 6 deletions scompose/project/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,17 @@ def set_network(self, params):
self.network[key] = self.network.get(key, True)

def set_ports(self, params):
"""set ports from the recipe to be used"""
"""
set ports from the recipe to be used
"""
self.ports = params.get("ports", [])

# Commands

def set_start(self, params):
"""set arguments to the startscript"""
"""
set arguments to the startscript
"""
start = params.get("start", {})
self.args = start.get("args", "")
self.start_opts = [
Expand All @@ -186,15 +190,19 @@ def set_start(self, params):
]

def set_exec(self, params):
"""set arguments for exec"""
"""
set arguments for exec
"""
exec_group = params.get("exec", {})
self.exec_args = exec_group.get("command", "")
if "|" in self.exec_args:
bot.exit("Pipes are not currently supported.")
self.exec_opts = self._get_command_opts(exec_group.get("options", []))

def set_run(self, params):
"""set arguments for run"""
"""
set arguments for run
"""
run_group = params.get("run", {}) or {}
self.run_args = run_group.get("args")
if self.run_args and "|" in self.run_args:
Expand Down Expand Up @@ -341,8 +349,7 @@ def build(self, working_dir):
elif self.recipe is not None:
# Change directory to the context if it exists
context = os.path.abspath(self.context)
if os.path.exists(context):
os.chdir(context)
os.chdir(context)

# The recipe is expected to exist in the context folder
if not os.path.exists(self.recipe):
Expand Down
14 changes: 7 additions & 7 deletions scompose/tests/test_command_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ def test_command_args(tmp_path):
bot.clear() ## Clear previously logged messages

cmd_args = os.path.join(here, "configs", "cmd_args")
for filename in os.listdir(cmd_args):
source = os.path.join(cmd_args, filename)
dest = os.path.join(tmp_path, filename)
print("Copying %s to %s" % (filename, dest))
shutil.copyfile(source, dest)
#for filename in os.listdir(cmd_args):
# source = os.path.join(cmd_args, filename)
# dest = os.path.join(tmp_path, filename)
# print("Copying %s to %s" % (filename, dest))
# shutil.copyfile(source, dest)

# Test the simple apache example
os.chdir(tmp_path)
os.chdir(cmd_args)

# Check for required files
assert "singularity-compose.yml" in os.listdir()
Expand All @@ -42,7 +42,7 @@ def test_command_args(tmp_path):
print("Testing build")
project.build()

assert "echo.sif" in os.listdir(tmp_path)
assert "echo.sif" in os.listdir(cmd_args)

print("Testing view config")
project.view_config()
Expand Down

0 comments on commit 085ef57

Please sign in to comment.