Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spack external find: show backtrace on error when --backtrace #47082

Merged
merged 1 commit into from
Oct 19, 2024

Conversation

haampie
Copy link
Member

@haampie haampie commented Oct 18, 2024

Sometimes there are bugs in the implementation of a package's detection methods. Currently that's hard to troubleshoot:

$ spack [--backtrace] -e . external find python
==> Warning: error detecting "python" from prefix /usr/bin ['example']
==> No new external packages detected

With this PR you at least get a backtrace (also with --debug):

$ spack -e . external find python
==> Warning: error detecting "python" from prefix /usr/bin: [KeyError: 'example']

$ spack --backtrace -e . external find python
==> Warning: error detecting "python" from prefix /usr/bin: Traceback (most recent call last):
  File "/home/harmen/spack/lib/spack/spack/detection/path.py", line 275, in detect_specs
    pkg.determine_spec_details(candidate_path, items_in_prefix)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/harmen/spack/lib/spack/spack/package_base.py", line 241, in determine_spec_details
    variants = cls.determine_variants(objs, version_str)
  File "/home/harmen/spack/var/spack/repos/builtin/packages/python/package.py", line 386, in determine_variants
KeyError: 'example'

The line is still off by one, but hopefully one day it'll correct itself ;)

@spackbot-app spackbot-app bot added the core PR affects Spack core functionality label Oct 18, 2024
@alalazo alalazo merged commit 9b8c06a into develop Oct 19, 2024
33 checks passed
@alalazo alalazo deleted the hs/fix/better-error-external-find branch October 19, 2024 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core PR affects Spack core functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants