Skip to content

Commit

Permalink
Address @tldalhgren review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
greenc-FNAL committed Aug 2, 2019
1 parent 53466e8 commit 5aeb9e5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
11 changes: 6 additions & 5 deletions lib/spack/docs/packaging_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -882,11 +882,12 @@ Git fetching supports the following parameters to ``version``:
* ``tag``: Name of a tag to fetch.
* ``commit``: SHA hash (or prefix) of a commit to fetch.
* ``submodules``: Also fetch submodules recursively when checking out this repository.
* ``full_depth``: If the version of git and the specified transport
protocol support it, `--depth 1` will be used unless this option is
`True`.
* ``all_branches``: If the version of git supports it, `--single-branch`
will be used unless this option is `True`.
* ``full_depth``: Ensure the full git history is checked out. Normally
(`full_depth=False` ), the git option `--depth 1` will be used if the
version of git and the specified transport protocol support it.
* ``all_branches``: Retrieve at least the HEAD commit (see `full_depth`
of all branches). Normally (`all_branches=False`), the git option
`--single-branch` will be used if the version of git supports it.

Only one of ``tag``, ``branch``, or ``commit`` can be used at a time.

Expand Down
16 changes: 8 additions & 8 deletions lib/spack/spack/fetch_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ def __init__(self, **kwargs):
# constructed at package construction time. This is where things
# will be fetched.
self.stage = None
# Possibly disable caching for this strategy.
self._no_cache_opt = kwargs.pop('no_cache', False)
# Enable or disable caching for this strategy?
self._cache_enabled = not kwargs.pop('no_cache', False)

def set_stage(self, stage):
"""This is called by Stage before any of the fetching
methods are called on the stage."""
self.stage = stage

@property
def no_cache_opt(self):
return self._no_cache_opt
def cache_enabled(self):
return self._cache_enabled

# Subclasses need to implement these methods
def fetch(self):
Expand Down Expand Up @@ -326,7 +326,7 @@ def archive_file(self):

@property
def cachable(self):
return (not self.no_cache_opt) and bool(self.digest)
return self._cache_enabled and bool(self.digest)

@_needs_stage
def expand(self):
Expand Down Expand Up @@ -676,7 +676,7 @@ def git(self):

@property
def cachable(self):
return (not self.no_cache_opt) and bool(self.commit or self.tag)
return self._cache_enabled and bool(self.commit or self.tag)

def source_id(self):
return self.commit or self.tag
Expand Down Expand Up @@ -845,7 +845,7 @@ def svn(self):

@property
def cachable(self):
return (not self.no_cache_opt) and bool(self.revision)
return self._cache_enabled and bool(self.revision)

def source_id(self):
return self.revision
Expand Down Expand Up @@ -953,7 +953,7 @@ def hg(self):

@property
def cachable(self):
return (not self.no_cache_opt) and bool(self.revision)
return self._cache_enabled and bool(self.revision)

def source_id(self):
return self.revision
Expand Down

0 comments on commit 5aeb9e5

Please sign in to comment.