pulumi/scripts/normpath

23 lines
398 B
Python
Executable File

#!/usr/bin/env python
"""Normalizes paths to work with the quirks of Bash running on Windows
GitHub actions workers.
For example, on Windows:
$ ./scripts/normpath "D:\\a\\pulumi\\pulumi/nuget"
D:\a\pulumi\pulumi\nuget
"""
import os
import pathlib
import sys
path = sys.argv[1]
if os.name == 'nt':
print(pathlib.PureWindowsPath(path))
else:
print(pathlib.PurePosixPath(path))