diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/cmd/view.py | 11 | ||||
-rw-r--r-- | lib/spack/spack/filesystem_view.py | 13 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/view.py | 13 |
3 files changed, 26 insertions, 11 deletions
diff --git a/lib/spack/spack/cmd/view.py b/lib/spack/spack/cmd/view.py index 03670329e6..4c1f1172e8 100644 --- a/lib/spack/spack/cmd/view.py +++ b/lib/spack/spack/cmd/view.py @@ -202,17 +202,6 @@ def view(parser, args): # status and remove can map the name to packages in view specs = relaxed_disambiguate(args.specs, view) - activated = list(filter(lambda s: s.package.is_extension and - s.package.is_activated(), specs)) - - if len(activated) > 0: - tty.error("Globally activated extensions cannot be used in " - "conjunction with filesystem views. " - "Please deactivate the following specs: ") - spack.cmd.display_specs(activated, flags=True, variants=True, - long=args.verbose) - return - with_dependencies = args.dependencies.lower() in ['true', 'yes'] # Map action to corresponding functionality diff --git a/lib/spack/spack/filesystem_view.py b/lib/spack/spack/filesystem_view.py index a3ed27e912..be47ad0b0c 100644 --- a/lib/spack/spack/filesystem_view.py +++ b/lib/spack/spack/filesystem_view.py @@ -260,6 +260,19 @@ class YamlFilesystemView(FilesystemView): % colorize_spec(spec)) return True + if spec.package.extendable: + # Check for globally activated extensions in the extendee that + # we're looking at. + activated = [p.spec for p in + spack.store.db.activated_extensions_for(spec)] + if activated: + tty.error("Globally activated extensions cannot be used in " + "conjunction with filesystem views. " + "Please deactivate the following specs: ") + spack.cmd.display_specs(activated, flags=True, variants=True, + long=False) + return False + tree = LinkTree(spec.prefix) if not self.ignore_conflicts: diff --git a/lib/spack/spack/test/cmd/view.py b/lib/spack/spack/test/cmd/view.py index 7c429f7fbc..26fc019deb 100644 --- a/lib/spack/spack/test/cmd/view.py +++ b/lib/spack/spack/test/cmd/view.py @@ -89,3 +89,16 @@ def test_view_extension_global_activation( assert 'extension1@1.0' in view_activated assert 'extension1@2.0' not in view_activated assert 'extension2@1.0' not in view_activated + + +def test_view_extendee_with_global_activations( + tmpdir, builtin_mock, mock_archive, mock_fetch, config, + install_mockery): + install('extendee') + install('extension1@1.0') + install('extension1@2.0') + install('extension2@1.0') + viewpath = str(tmpdir.mkdir('view')) + activate('extension1@2.0') + output = view('symlink', viewpath, 'extension1@1.0') + assert 'Error: Globally activated extensions cannot be used' in output |