summaryrefslogtreecommitdiff
path: root/buildstream/scriptelement.py
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-06-15 19:52:27 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-06-15 19:54:51 +0900
commitb076d2e88518a225767844e06f30e9dbaca83015 (patch)
tree80129fbaf1a579af42c3be71bf785d6d551c461a /buildstream/scriptelement.py
parent9aae2d6e672bd2fe4b3203d950defea5806ab2df (diff)
downloadbuildstream-b076d2e88518a225767844e06f30e9dbaca83015.tar.gz
scriptelement.py: Fixing some fallout in scriptelement
Recently added code which iterates over the layout to mark the non-root directories in the sandbox, but selt.__layout can be None, just changed to make the default class data be an empty list (which is an equally a falsy value as None, so other code need not change).
Diffstat (limited to 'buildstream/scriptelement.py')
-rw-r--r--buildstream/scriptelement.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/buildstream/scriptelement.py b/buildstream/scriptelement.py
index f0a6cee9b..399ee9613 100644
--- a/buildstream/scriptelement.py
+++ b/buildstream/scriptelement.py
@@ -41,7 +41,7 @@ class ScriptElement(Element):
__cwd = "/"
__root_read_only = False
__commands = None
- __layout = None
+ __layout = []
def set_work_dir(self, work_dir=None):
"""Sets the working dir
@@ -118,6 +118,10 @@ class ScriptElement(Element):
In the case that no element is specified, a read-write directory will
be made available at the specified location.
"""
+ #
+ # Even if this is an empty list by default, make sure that it's
+ # instance data instead of appending stuff directly onto class data.
+ #
if not self.__layout:
self.__layout = []
self.__layout.append({"element": element,