Simplify Windows path calc for NuGet source

This commit is contained in:
Anton Tayanovskyy 2021-11-23 00:26:58 -05:00
parent 3490e2ff82
commit 229be2b0a0
2 changed files with 8 additions and 9 deletions

View file

@ -284,7 +284,12 @@ jobs:
path: ${{ github.workspace }}/nuget
- name: Add NuGet packages as a local NuGet source
run: |
dotnet nuget add source $(./scripts/normpath $PWD/nuget)
echo "PULUMI_LOCAL_NUGET=$PULUMI_LOCAL_NUGET"
SOURCE=$(./scripts/normpath $PULUMI_LOCAL_NUGET)
echo "SOURCE=$SOURCE"
dotnet nuget add source $SOURCE
env:
PULUMI_LOCAL_NUGET: ${{ github.workspace }}/nuget
- name: Verify Pulumi Version
run: |
which pulumi

View file

@ -5,7 +5,7 @@ GitHub actions workers.
For example, on Windows:
$ python realpath.py /d/a/pulumi/pulumi/nuget
$ ./scripts/normpath "D:\\a\\pulumi\\pulumi/nuget"
D:\a\pulumi\pulumi\nuget
"""
@ -17,12 +17,6 @@ import sys
path = sys.argv[1]
if os.name == 'nt':
path = pathlib.PureWindowsPath(path)
if path.root == '\\':
# Assume drive is encoded as /d/x/full/path
_, drive, rest = str(path).split('\\', 2)
print(pathlib.PureWindowsPath(f'{drive}:\\', rest))
else:
print(path)
print(pathlib.PureWindowsPath(path))
else:
print(pathlib.PurePosixPath(path))