Skip to content

Commit 95c6fbb

Browse files
authored
Make mkdir.py work under python3 versions below 3.5 (#8194)
* Make mkdir.py work unter python3 versions below 3.5 Because early versions of python3 did not have the optional arg "exist_ok" for "pathlib.Path(...).mkdir(...)" a build under this versions will abort with an error message. This PR will modify the python script so that it works even under python 3.4 (and below).
1 parent 2946ce0 commit 95c6fbb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: tools/mkdir.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ def main():
1212
parser.add_argument('dir', action='store', nargs='+')
1313
ns = parser.parse_args()
1414
for p in ns.dir:
15-
pathlib.Path(p).mkdir(parents=ns.parents, exist_ok=True)
15+
try:
16+
pathlib.Path(p).mkdir(parents=ns.parents)
17+
except FileExistsError:
18+
pass
1619
return 0
1720

1821
if __name__ == '__main__':

0 commit comments

Comments
 (0)