summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoralalazo <massimiliano.culpo@googlemail.com>2016-03-02 13:16:04 +0100
committeralalazo <massimiliano.culpo@googlemail.com>2016-03-02 13:16:04 +0100
commitd649b715edae0871254695e2deacf078554a1475 (patch)
treebe9370bd072eec6c602456492892cb53fcc4ef29 /lib
parent65b2a24f7c12380d0815e5705d1c1e66e5fd22a9 (diff)
downloadspack-d649b715edae0871254695e2deacf078554a1475.tar.gz
spack-d649b715edae0871254695e2deacf078554a1475.tar.bz2
spack-d649b715edae0871254695e2deacf078554a1475.tar.xz
spack-d649b715edae0871254695e2deacf078554a1475.zip
stage : updated functions doc
_cleanup_dead_links : fixed minor bug
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/stage.py49
1 files changed, 21 insertions, 28 deletions
diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py
index 48770fb407..900acd664d 100644
--- a/lib/spack/spack/stage.py
+++ b/lib/spack/spack/stage.py
@@ -42,33 +42,26 @@ STAGE_PREFIX = 'spack-stage-'
class Stage(object):
- """A Stage object manages a directory where some source code is
- downloaded and built before being installed. It handles
- fetching the source code, either as an archive to be expanded
- or by checking it out of a repository. A stage's lifecycle
- looks like this:
-
- Stage()
- Constructor creates the stage directory.
- fetch()
- Fetch a source archive into the stage.
- expand_archive()
- 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
- in a tmp directory. Otherwise, stages are created directly in
- spack.stage_path.
-
- There are two kinds of stages: named and unnamed. Named stages can
- persist between runs of spack, e.g. if you fetched a tarball but
- didn't finish building it, you won't have to fetch it again.
-
- Unnamed stages are created using standard mkdtemp mechanisms or
- similar, and are intended to persist for only one run of spack.
+ """
+ A Stage object is a context manager that handles a directory where some source code is downloaded and built
+ before being installed. It handles fetching the source code, either as an archive to be expanded or by checking
+ it out of a repository. A stage's lifecycle looks like this:
+
+ ```
+ with Stage() as stage: # Context manager creates and destroys the stage directory
+ fetch() # Fetch a source archive into the stage.
+ expand_archive() # Expand the source archive.
+ <install> # Build and install the archive. This is handled by the Package class.
+ ```
+
+ If spack.use_tmp_stage is True, spack will attempt to create stages in a tmp directory.
+ Otherwise, stages are created directly in spack.stage_path.
+
+ There are two kinds of stages: named and unnamed. Named stages can persist between runs of spack, e.g. if you
+ fetched a tarball but didn't finish building it, you won't have to fetch it again.
+
+ Unnamed stages are created using standard mkdtemp mechanisms or similar, and are intended to persist for
+ only one run of spack.
"""
def __init__(self, url_or_fetch_strategy, **kwargs):
@@ -164,7 +157,7 @@ class Stage(object):
path = join_path(spack.stage_path, file)
if os.path.islink(path):
real_path = os.path.realpath(path)
- if not os.path.exists(path):
+ if not os.path.exists(real_path):
os.unlink(path)
def _need_to_create_path(self):