diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6b1149ea..87b9656f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 }} @@ -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 @@ -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 }} diff --git a/manager/__init__.py b/manager/__init__.py index 7969510e..257e0b8f 100644 --- a/manager/__init__.py +++ b/manager/__init__.py @@ -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)) diff --git a/manager/environment_utils.py b/manager/environment_utils.py index 1ae872eb..8f777b8b 100644 --- a/manager/environment_utils.py +++ b/manager/environment_utils.py @@ -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""" @@ -20,14 +22,18 @@ 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 @@ -35,10 +41,15 @@ def append_includes(self, value): 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 @@ -46,7 +57,12 @@ def prepend_includes(self, value): 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