diff options
author | Harmen Stoppels <harmenstoppels@gmail.com> | 2021-08-02 14:17:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-02 14:17:41 +0200 |
commit | ac8521e9b3aaa8fa1526c56f93ecc4a1940fba97 (patch) | |
tree | 9037411371af9d8f8d7cadc560fc74b76c2ca797 | |
parent | d628e3ba5cda0ce485ad9c51f6f2f04b6f3d3311 (diff) | |
download | spack-ac8521e9b3aaa8fa1526c56f93ecc4a1940fba97.tar.gz spack-ac8521e9b3aaa8fa1526c56f93ecc4a1940fba97.tar.bz2 spack-ac8521e9b3aaa8fa1526c56f93ecc4a1940fba97.tar.xz spack-ac8521e9b3aaa8fa1526c56f93ecc4a1940fba97.zip |
Do not issue a warning for a missing source id when installing from local sources (#24960)
-rw-r--r-- | lib/spack/spack/environment.py | 4 | ||||
-rw-r--r-- | lib/spack/spack/package.py | 4 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/env.py | 12 |
3 files changed, 19 insertions, 1 deletions
diff --git a/lib/spack/spack/environment.py b/lib/spack/spack/environment.py index f2ed7f39b0..cc5a066abb 100644 --- a/lib/spack/spack/environment.py +++ b/lib/spack/spack/environment.py @@ -1180,6 +1180,10 @@ class Environment(object): return True return False + def is_develop(self, spec): + """Returns true when the spec is built from local sources""" + return spec.name in self.dev_specs + def concretize(self, force=False, tests=False): """Concretize user_specs in this environment. diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 2f63af1377..40b77ee124 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -1537,7 +1537,9 @@ class PackageBase(six.with_metaclass(PackageMeta, PackageViewMixin, object)): # should this attempt to download the source and set one? This # probably only happens for source repositories which are # referenced by branch name rather than tag or commit ID. - if not self.spec.external: + env = spack.environment.get_env(None, None) + from_local_sources = env and env.is_develop(self.spec) + if not self.spec.external and not from_local_sources: message = 'Missing a source id for {s.name}@{s.version}' tty.warn(message.format(s=self)) hash_content.append(''.encode('utf-8')) diff --git a/lib/spack/spack/test/cmd/env.py b/lib/spack/spack/test/cmd/env.py index 58094e1abb..e680507322 100644 --- a/lib/spack/spack/test/cmd/env.py +++ b/lib/spack/spack/test/cmd/env.py @@ -2591,3 +2591,15 @@ def test_virtual_spec_concretize_together(tmpdir): e.concretize() assert any(s.package.provides('mpi') for _, s in e.concretized_specs()) + + +def test_query_develop_specs(): + """Test whether a spec is develop'ed or not""" + env('create', 'test') + with ev.read('test') as e: + e.add('mpich') + e.add('mpileaks') + e.develop(Spec('mpich@1'), 'here', clone=False) + + assert e.is_develop(Spec('mpich')) + assert not e.is_develop(Spec('mpileaks')) |