build.run: make sure BuildProducts._root is not easily accessible.
This commit is contained in:
parent
2829d04033
commit
b6b9f0fc21
|
@ -56,11 +56,13 @@ class BuildPlan:
|
|||
|
||||
class BuildProducts:
|
||||
def __init__(self, root):
|
||||
self._root = root
|
||||
# We provide no guarantees that files will be available on the local filesystem (i.e. in
|
||||
# any way other than through `products.get()`), so downstream code must never rely on this.
|
||||
self.__root = root
|
||||
|
||||
def get(self, filename, mode="b"):
|
||||
assert mode in "bt"
|
||||
with open(os.path.join(self._root, filename), "r" + mode) as f:
|
||||
with open(os.path.join(self.__root, filename), "r" + mode) as f:
|
||||
return f.read()
|
||||
|
||||
@contextmanager
|
||||
|
|
Loading…
Reference in a new issue