Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions llvm/utils/lit/lit/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,7 @@ def mkdir(path):
def mkdir_p(path):
"""mkdir_p(path) - Make the "path" directory, if it does not exist; this
will also make directories for any missing parent directories."""
if not path or os.path.exists(path):
return

parent = os.path.dirname(path)
if parent != path:
mkdir_p(parent)

mkdir(path)
os.makedirs(path, exist_ok=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks much simpler, nice. Not a Windows expert but do we need to remap long paths using something like this?

Suggested change
os.makedirs(path, exist_ok=True)
if platform.system() == "Windows":
if not path.startswith(r"\\?\"):
path = r"\\?\" + path
os.makedirs(path, exist_ok=True)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure - do our python script do such path mangling anywhere else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They do in the def mkdir(path): above.

It sounds like python3.6 supports long paths if they are enabled in the registry so there should be no need to work around it here anymore:
https://bugs.python.org/issue27731 -> https://hg.python.org/cpython/rev/26601191b368

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see.



def listdir_files(dirname, suffixes=None, exclude_filenames=None, prefixes=None):
Expand Down