From: Dylan Baker <[email protected]>
This simplifies the function.
---
framework/core.py | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/framework/core.py b/framework/core.py
index 870a708..c339572 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -117,17 +117,13 @@ def get_config(arg=None):
# Ensure the given directory exists
def checkDir(dirname, failifexists):
- exists = True
try:
os.stat(dirname)
except OSError as e:
- if e.errno in [errno.ENOENT, errno.ENOTDIR]:
- exists = False
-
- if exists and failifexists:
- print("%(dirname)s exists already.\nUse --overwrite if "
- "you want to overwrite it.\n" % locals(), file=sys.stderr)
- exit(1)
+ if e.errno not in [errno.ENOENT, errno.ENOTDIR] and failifexists:
+ print("%(dirname)s exists already.\nUse --overwrite if "
+ "you want to overwrite it.\n" % locals(), file=sys.stderr)
+ exit(1)
try:
os.makedirs(dirname)
--
2.8.2
_______________________________________________
Piglit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/piglit