Skip to content

Commit 068b62c

Browse files
committed
Use jq's IN() instead of index()
The end result is the same, but the construction is more ergonomic.
1 parent e7036a2 commit 068b62c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Dockerfile-windows-servercore.template

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{{ def is_3: env.version | startswith("3") -}}
2-
{{ def cmd: if [ "3.8" ] | index(env.version) then "pypy3" else "pypy" end -}}
32
FROM mcr.microsoft.com/windows/{{ env.windowsVariant }}:{{ env.windowsRelease }}
43

54
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
@@ -68,8 +67,8 @@ RUN $url = '{{ .arches["windows-amd64"].url }}'; \
6867
Write-Host 'Renaming ...'; \
6968
Rename-Item -Path C:\{{ .arches["windows-amd64"].url | rtrimstr(".zip") | split("/")[-1] }} -NewName C:\pypy; \
7069
\
71-
Write-Host 'Verifying install ("{{ cmd }} --version") ...'; \
72-
{{ cmd }} --version; \
70+
Write-Host 'Verifying install ("pypy --version") ...'; \
71+
pypy --version; \
7372
\
7473
Write-Host 'Cleanup install ...'; \
7574
Get-ChildItem \
@@ -100,11 +99,11 @@ RUN Write-Host ('Downloading get-pip.py ({0}) ...' -f $env:PYTHON_GET_PIP_URL);
10099
exit 1; \
101100
}; \
102101
\
103-
$pipVersion = & {{ cmd }} -c 'import ensurepip; print(ensurepip._PIP_VERSION)'; \
104-
$setuptoolsVersion = & {{ cmd }} -c 'import ensurepip; print(ensurepip._SETUPTOOLS_VERSION)'; \
102+
$pipVersion = & pypy -c 'import ensurepip; print(ensurepip._PIP_VERSION)'; \
103+
$setuptoolsVersion = & pypy -c 'import ensurepip; print(ensurepip._SETUPTOOLS_VERSION)'; \
105104
\
106105
Write-Host ('Installing "pip == {0}", "setuptools == {1}" ...' -f $pipVersion, $setuptoolsVersion); \
107-
{{ cmd }} get-pip.py \
106+
pypy get-pip.py \
108107
--disable-pip-version-check \
109108
--no-cache-dir \
110109
('pip == {0}' -f $pipVersion) \
@@ -131,4 +130,4 @@ RUN Write-Host ('Downloading get-pip.py ({0}) ...' -f $env:PYTHON_GET_PIP_URL);
131130
\
132131
Write-Host 'Complete.'
133132

134-
CMD {{ [ cmd ] | @json }}
133+
CMD ["pypy"]

0 commit comments

Comments
 (0)