stage : updated functions doc

_cleanup_dead_links : fixed minor bug
This commit is contained in:
alalazo 2016-03-02 13:16:04 +01:00
parent 65b2a24f7c
commit d649b715ed

View File

@ -42,33 +42,26 @@
class Stage(object): class Stage(object):
"""A Stage object manages a directory where some source code is """
downloaded and built before being installed. It handles A Stage object is a context manager that handles a directory where some source code is downloaded and built
fetching the source code, either as an archive to be expanded before being installed. It handles fetching the source code, either as an archive to be expanded or by checking
or by checking it out of a repository. A stage's lifecycle it out of a repository. A stage's lifecycle looks like this:
looks like this:
Stage() ```
Constructor creates the stage directory. with Stage() as stage: # Context manager creates and destroys the stage directory
fetch() fetch() # Fetch a source archive into the stage.
Fetch a source archive into the stage. expand_archive() # Expand the source archive.
expand_archive() <install> # Build and install the archive. This is handled by the Package class.
Expand the source archive. ```
<install>
Build and install the archive. This is handled by the Package class.
destroy()
Remove the stage once the package has been installed.
If spack.use_tmp_stage is True, spack will attempt to create stages If spack.use_tmp_stage is True, spack will attempt to create stages in a tmp directory.
in a tmp directory. Otherwise, stages are created directly in Otherwise, stages are created directly in spack.stage_path.
spack.stage_path.
There are two kinds of stages: named and unnamed. Named stages can There are two kinds of stages: named and unnamed. Named stages can persist between runs of spack, e.g. if you
persist between runs of spack, e.g. if you fetched a tarball but fetched a tarball but didn't finish building it, you won't have to fetch it again.
didn't finish building it, you won't have to fetch it again.
Unnamed stages are created using standard mkdtemp mechanisms or Unnamed stages are created using standard mkdtemp mechanisms or similar, and are intended to persist for
similar, and are intended to persist for only one run of spack. only one run of spack.
""" """
def __init__(self, url_or_fetch_strategy, **kwargs): def __init__(self, url_or_fetch_strategy, **kwargs):
@ -164,7 +157,7 @@ def _cleanup_dead_links(self):
path = join_path(spack.stage_path, file) path = join_path(spack.stage_path, file)
if os.path.islink(path): if os.path.islink(path):
real_path = os.path.realpath(path) real_path = os.path.realpath(path)
if not os.path.exists(path): if not os.path.exists(real_path):
os.unlink(path) os.unlink(path)
def _need_to_create_path(self): def _need_to_create_path(self):