Verified Commit a66a3cc5 authored by c's avatar c
Browse files

TorNet: update mkdir_p() to work with pathlib

Modify both mkdir_p() function signature, return value, and calling
spots to accomodate for the change from os.path to pathlib
parent 3c1a744d
......@@ -100,7 +100,7 @@ def getenv_bool(env_var, default):
return getenv_type(env_var, default, bool, type_name='a bool')
def mkdir_p(d, mode=448):
def mkdir_p(*d, mode=448):
"""Create directory 'd' and all of its parents as needed. Unlike
os.makedirs, does not give an error if d already exists.
......@@ -112,12 +112,7 @@ def mkdir_p(d, mode=448):
permissions for the intermediate directories. In python3, 'mode'
only sets the mode for the last directory created.
os.makedirs(d, mode=mode)
except OSError as e:
if e.errno == errno.EEXIST:
Path(*d).mkdir(mode=mode, parents=True, exist_ok=True)
def make_datadir_subdirectory(datadir, subdir):
......@@ -125,7 +120,7 @@ def make_datadir_subdirectory(datadir, subdir):
that datadirectory. Ensure that both are mode 700.
mkdir_p(os.path.join(datadir, subdir))
mkdir_p(datadir, subdir)
def get_absolute_chutney_path():
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment