Skip to content

Non path-based package repositories in environments broken #51054

@tehrengruber

Description

@tehrengruber

Steps to reproduce

Example environment file spack.yaml

spack:
  repos:
    builtin:
      branch: develop

Error message

Then creating the environment fails with

$ spack env create myenv spack.yaml
==> Error: expected string or bytes-like object, got 'CommentedMap'

This issue is a result of #49084 which breaks all non path-based repositories in environments. I will open a PR with a fix soon. Strangely there is no stacktrace printed on

$ spack --debug --stacktrace env create myenv spack.yaml                                                                                                                                 
==> Error: expected string or bytes-like object, got 'CommentedMap'

but here is the one I got in the test case I wrote

/usr/lib/python3.13/contextlib.py:141: in __enter__
    return next(self.gen)
lib/spack/spack/test/cmd/env.py:226: in _installed_environment
    env("create", "test", "./spack.yaml")
lib/spack/spack/main.py:664: in __call__
    self.returncode = _invoke_command(command, self.parser, args, unknown)
lib/spack/spack/main.py:591: in _invoke_command
    return_val = command(parser, args)
lib/spack/spack/cmd/env.py:1095: in env
    action(args)
lib/spack/spack/cmd/env.py:118: in env_create
    env = _env_create(
lib/spack/spack/cmd/env.py:154: in _env_create
    env = ev.create(
lib/spack/spack/environment/environment.py:334: in create
    return create_in_dir(
lib/spack/spack/environment/environment.py:399: in create_in_dir
    _rewrite_relative_repos_paths_on_relocation(env, init_file_dir)
lib/spack/spack/environment/environment.py:443: in _rewrite_relative_repos_paths_on_relocation
    repo_path = substitute_path_variables(entry)
lib/spack/spack/util/path.py:196: in substitute_path_variables
    path = substitute_config_variables(path)
lib/spack/spack/util/path.py:191: in substitute_config_variables
    return re.sub(r"(\$\w+\b|\$\{\w+\})", repl, path)

Information on your system

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have searched the issues of this repo and believe this is not a duplicate
  • I have run the failing commands in debug mode and reported the output

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingimpact-lowv1.0.1PRs to backport for v1.0.1

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions