Conditions | 4 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | # -*- coding: utf-8 -*- |
||
8 | 1 | def create_parent_dirs(path, cwd=None, mode=493): |
|
9 | ''' |
||
10 | create parent directories tree for a path |
||
11 | |||
12 | mode : 493 in decimal = 0755 in octal |
||
13 | ''' |
||
14 | |||
15 | 1 | if not os.path.isabs(path): |
|
16 | 1 | cwd = cwd if cwd else os.getcwd() |
|
17 | 1 | path = cwd + '/' + path |
|
18 | |||
19 | 1 | parent_dir = os.path.dirname(path) |
|
20 | 1 | if not os.path.exists(parent_dir): |
|
21 | 1 | os.makedirs(parent_dir, mode) |
|
22 | |||
23 | 1 | return path |
|
24 | |||
49 |