Skip to content

Commit

Permalink
Fix style errors in spack-stack extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
climbfuji committed Oct 3, 2023
1 parent e7b797a commit 6c02740
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 32 deletions.
14 changes: 4 additions & 10 deletions lib/jcsda-emc/spack-stack/stack/cmd/stack_cmds/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,17 @@ def setup_common_parser_args(subparser):
def setup_ctr_parser(subparser):
"""create container-specific parsing options"""

subparser.add_argument("--container",
required=True,
help=container_config_help()
)
subparser.add_argument("--container", required=True, help=container_config_help())

subparser.add_argument("--specs",
required=True,
help=container_specs_help()
)
subparser.add_argument("--specs", required=True, help=container_specs_help())

subparser.add_argument(
"--dir",
type=str,
required=False,
default=default_env_path,
help="Environment will be placed in <dir>/container/."
" Default is {}/container/.".format(default_env_path)
" Default is {}/container/.".format(default_env_path),
)

setup_common_parser_args(subparser)
Expand All @@ -121,7 +115,7 @@ def setup_env_parser(subparser):
type=str,
required=False,
default=None,
help='Environment name, defaults to <template>.<site>',
help="Environment name, defaults to <template>.<site>",
)

subparser.add_argument(
Expand Down
16 changes: 1 addition & 15 deletions lib/jcsda-emc/spack-stack/stack/container_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@

import spack
import spack.util.spack_yaml as syaml
from spack.extensions.stack.stack_paths import (
common_path,
container_path,
container_specs_path,
)
from spack.extensions.stack.stack_paths import common_path, container_path, container_specs_path


class StackContainer:
Expand Down Expand Up @@ -45,13 +41,6 @@ def write(self):
"""Merge base packages and app's spack.yaml into
output container file.
"""
#template_env = os.path.join(self.template_path, "spack.yaml")
#with open(template_env, "r") as f:
# # Spack uses :: to override settings.
# # but it's not understood when used in a spack.yaml
# filedata = f.read()
# filedata = filedata.replace("::", ":")
# template_yaml = syaml.load_config(filedata)

with open(self.container_path, "r") as f:
filedata = f.read()
Expand All @@ -61,9 +50,6 @@ def write(self):
with open(self.specs_path, "r") as f:
specs_yaml = syaml.load_config(f)

# Create copy so we can modify it
original_yaml = copy.deepcopy(container_yaml)

with open(self.base_packages, "r") as f:
filedata = f.read()
filedata = filedata.replace("::", ":")
Expand Down
14 changes: 7 additions & 7 deletions lib/jcsda-emc/spack-stack/stack/stack_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Hidden file in top-level spack-stack dir so this module can
# find relative config files. Assuming Spack is a submodule of
# spack-stack.
check_file = '.spackstack'
check_file = ".spackstack"


# Find spack-stack directory assuming this Spack instance
Expand All @@ -14,13 +14,13 @@ def stack_path(*paths):
stack_dir = os.path.dirname(spack.paths.spack_root)

if not os.path.exists(os.path.join(stack_dir, check_file)):
raise Exception('Not a submodule of spack-stack')
raise Exception("Not a submodule of spack-stack")

return os.path.join(stack_dir, *paths)


common_path = stack_path('configs', 'common')
site_path = stack_path('configs', 'sites')
container_path = stack_path('configs', 'containers')
container_specs_path = stack_path('configs', 'containers', 'specs')
template_path = stack_path('configs', 'templates')
common_path = stack_path("configs", "common")
site_path = stack_path("configs", "sites")
container_path = stack_path("configs", "containers")
container_specs_path = stack_path("configs", "containers", "specs")
template_path = stack_path("configs", "templates")

0 comments on commit 6c02740

Please sign in to comment.