Skip to content

Commit 02cd10d

Browse files
committed
add util
1 parent 9863dc7 commit 02cd10d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

scripts/util.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
import os
5+
import errno
6+
7+
def mkdir_p(path):
8+
try:
9+
os.makedirs(path)
10+
except OSError as exc: # Python >2.5
11+
if exc.errno == errno.EEXIST and os.path.isdir(path):
12+
pass
13+
else:
14+
raise
15+
16+
17+
def par_dir(path):
18+
return os.path.abspath(os.path.join(path, os.pardir))

0 commit comments

Comments
 (0)