From: Dylan Baker <[email protected]>
Signed-off-by: Dylan Baker <[email protected]>
---
framework/core.py | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/framework/core.py b/framework/core.py
index 97b9a4b..60213c2 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -114,8 +114,24 @@ def get_config(arg=None):
pass
-# Ensure the given directory exists
def check_dir(dirname, failifexists=False):
+ """Check for the existance of a directory and create it if possible.
+
+ This function will check for the existance of a directory. If that
+ directory doesn't exist it will try to create it. If the directory does
+ exist than it does one of two things.
+ 1) If "failifexists" is False (default): it will just return
+ 2) If "failifexists" is True it will raise an PiglitException, it is the
+ job of the caller using failifexists=True to handle this exception
+
+ Arguments:
+ dirname -- the name of the directory to check
+
+ Keyword Arguments:
+ failifexists -- If True and the directory exists then PiglitException will
+ be raised (default: False)
+
+ """
try:
os.stat(dirname)
except OSError as e:
--
2.8.2
_______________________________________________
Piglit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/piglit