summaryrefslogtreecommitdiff
path: root/src/leap/util/fileutil.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2013-01-31 05:26:18 +0900
committerkali <kali@leap.se>2013-01-31 05:30:28 +0900
commit555210630659018785fdb9d2318081a76b49fb4c (patch)
treedf7a51aaa32d9436a86881f9815d66a0f28773a5 /src/leap/util/fileutil.py
parent00276d12b44630315c19ff2cd0f906eac34d92cf (diff)
actually merge the release/v0.2.0 branch!
My life has been a lie until this moment... I had done: git merge -s ours release/v0.2.0 to avoid deleting the debian folder... but that left the src untouched... Now I just rm'd the src folder and did a git checkout release/v0.2.0 src/ ... and merge happy! :)
Diffstat (limited to 'src/leap/util/fileutil.py')
-rw-r--r--src/leap/util/fileutil.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/leap/util/fileutil.py b/src/leap/util/fileutil.py
index 429e4b12..820ffe46 100644
--- a/src/leap/util/fileutil.py
+++ b/src/leap/util/fileutil.py
@@ -21,7 +21,7 @@ def extend_path():
# XXX add mac / win extended search paths?
-def which(program):
+def which(program, path=None):
"""
an implementation of which
that extends the path with
@@ -67,8 +67,10 @@ def which(program):
else:
# extended iterator
# with extra path
+ if path is None:
+ path = os.environ['PATH']
extended_path = chain(
- iter_path(os.environ["PATH"]),
+ iter_path(path),
iter_path(extend_path()))
for candidate in extended_path:
if candidate is not None:
@@ -91,6 +93,11 @@ def mkdir_p(path):
raise
+def mkdir_f(path):
+ folder, fname = os.path.split(path)
+ mkdir_p(folder)
+
+
def check_and_fix_urw_only(_file):
"""
test for 600 mode and try