bugfix: 'submodules' attribute should imply git fetch

- 'submodules' wasn't properly declared as an optional attribute for git
  fetcher

- add it and add a test.
This commit is contained in:
Todd Gamblin 2018-08-24 11:45:35 -07:00
parent 3f0e6d04e0
commit 3c292de6bd
3 changed files with 9 additions and 1 deletions

View file

@ -596,7 +596,7 @@ class GitFetchStrategy(VCSFetchStrategy):
""" """
enabled = True enabled = True
url_attr = 'git' url_attr = 'git'
optional_attrs = ['tag', 'branch', 'commit'] optional_attrs = ['tag', 'branch', 'commit', 'submodules']
def __init__(self, **kwargs): def __init__(self, **kwargs):
# Discards the keywords in kwargs that may conflict with the next call # Discards the keywords in kwargs that may conflict with the next call

View file

@ -341,6 +341,13 @@ def test_git_url_top_level_git_versions(mock_packages, config):
assert fetcher.commit == 'abc34' assert fetcher.commit == 'abc34'
assert fetcher.branch is None assert fetcher.branch is None
fetcher = spack.fetch_strategy.for_package_version(pkg, 'submodules')
assert isinstance(fetcher, spack.fetch_strategy.GitFetchStrategy)
assert fetcher.url == 'https://example.com/some/git/repo'
assert fetcher.tag is None
assert fetcher.commit is None
assert fetcher.branch is None
fetcher = spack.fetch_strategy.for_package_version(pkg, 'develop') fetcher = spack.fetch_strategy.for_package_version(pkg, 'develop')
assert isinstance(fetcher, spack.fetch_strategy.GitFetchStrategy) assert isinstance(fetcher, spack.fetch_strategy.GitFetchStrategy)
assert fetcher.url == 'https://example.com/some/git/repo' assert fetcher.url == 'https://example.com/some/git/repo'

View file

@ -39,6 +39,7 @@ class GitUrlTopLevel(Package):
# These resolve to git fetchers # These resolve to git fetchers
version('develop', branch='develop') version('develop', branch='develop')
version('submodules', submodules=True)
version('3.4', commit='abc34') version('3.4', commit='abc34')
version('3.3', branch='releases/v3.3', commit='abc33') version('3.3', branch='releases/v3.3', commit='abc33')
version('3.2', branch='releases/v3.2') version('3.2', branch='releases/v3.2')