Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
psakievich committed Jul 16, 2024
1 parent ede7b72 commit 485443e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 20 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fail-fast: false
matrix:
python-version: [3.8, 3.9, 3.12]
spack-version: [0.21.2, 0.22.0, develop]
spack-version: [0.21.2, 0.22.0, 0.22.1, develop]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -65,7 +65,9 @@ jobs:
run: |
ls -lh "$PWD/spack"
ls -lh "$PWD/spack/.github/"
cp ${GITHUB_WORKSPACE}/spack/.github/workflows/style/requirements.txt "$PWD"
if [ -f ${GITHUB_WORKSPACE}/spack/.github/workflows/style/requirements.txt]; cp ${GITHUB_WORKSPACE}/spack/.github/workflows/style/requirements.txt "$PWD"; fi
# breaking change https://github.com/spack/spack/pull/45037
if [ -f ${GITHUB_WORKSPACE}/spack/.github/workflows/requirements/style/requirements.txt]; cp ${GITHUB_WORKSPACE}/spack/.github/workflows/requirements/style/requirements.txt "$PWD"; fi
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install extension
Expand All @@ -78,7 +80,7 @@ jobs:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
spack-version: [0.21.2, 0.22.0, develop]
spack-version: [0.21.2, 0.22.0, 0.22.1, develop]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down
1 change: 0 additions & 1 deletion manager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def remove_project_via_index(index):
config_yaml["spack-manager"]["projects"].pop(index)
write_config()
else:
breakpoint()
raise MissingProjectException("No project is registered with the index {0}".format(index))


Expand Down
48 changes: 32 additions & 16 deletions manager/environment_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import spack.environment.environment as senv


__attrs__ = ["configuration", "pristine_configuration"]

# TODO spack version dependent code
class SpackManagerEnvironmentManifest(senv.EnvironmentManifestFile):
"""Spack-Manager extension to the manifest file for prototyping"""
Expand All @@ -20,33 +22,47 @@ def set_config_value(self, root, key, value=None):
key: next level where we will be updating
value: value to set
"""
if value:
if root not in self.configuration:
self.configuration[root] = {}
self.configuration.get(root, {})[key] = value
else:
self.configuration[root] = key

self.changed = True
for attr in __attrs__:
if hasattr(self, attr):
configuration = getattr(self, attr)
else:
continue
if value:
if root not in configuration:
configuration[root] = {}
configuration.get(root, {})[key] = value
else:
configuration[root] = key
self.changed = True

def append_includes(self, value):
"""Add to the includes in the manifest
Args:
value: value to add at the end of the list
"""
if "include" not in self.configuration:
self.configuration["include"] = []
self.configuration.get("include", []).append(value)
self.changed = True
for attr in __attrs__:
if hasattr(self, attr):
configuration = getattr(self, attr)
else:
continue
if "include" not in configuration:
configuration["include"] = []
configuration.get("include", []).append(value)
self.changed = True

def prepend_includes(self, value):
"""Add to the includes in the manifest
Args:
value: value to add at the beginning of the list
"""
if "include" not in self.configuration:
self.configuration["include"] = []
self.configuration.get("include", [])[:0] = [value]
self.changed = True
for attr in __attrs__:
if hasattr(self, attr):
configuration = getattr(self, attr)
else:
continue
if "include" not in configuration:
configuration["include"] = []
configuration.get("include", [])[:0] = [value]
self.changed = True

0 comments on commit 485443e

Please sign in to comment.