@@ -100,39 +100,32 @@ RUN npm install --global @vscode/vsce yarn && \
100100 rm --force --recursive design50.vsix && \
101101 npm uninstall --global vsce yarn
102102
103- # Remove the run button from both the main Python extension, debugger, and environments extensions
104- RUN cd /tmp && \
105- git clone --branch v2025.14.0 --depth 1 https://github.com/microsoft/vscode-python.git && \
106- cd vscode-python && \
107- # Remove the editor/title/run entry and save back to package.json
108- jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && mv package.tmp.json package.json && \
109- npm install && \
110- npm run package && \
111- mv ms-python-insiders.vsix /opt/cs50/extensions && \
112- cd /tmp && \
113- rm --force --recursive vscode-python
114103
104+ # This builds custom versions of Microsoft's Python extensions without the "Run Python File" button
115105RUN cd /tmp && \
116- git clone --branch v2025.10.0 --depth 1 https://github.com/microsoft/vscode-python-debugger.git && \
117- cd vscode-python-debugger && \
118- # Remove the editor/title/run entry and save back to package.json
119- jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && mv package.tmp.json package.json && \
120- npm install && \
121- npm run vsce-package && \
122- mv python-debugger.vsix /opt/cs50/extensions && \
123- cd /tmp && \
124- rm --force --recursive vscode-python-debugger
125-
126- RUN cd /tmp && \
127- git clone --branch v1.8.0 --depth 1 https://github.com/microsoft/vscode-python-environments.git && \
128- cd vscode-python-environments && \
129- # Remove the editor/title/run entry and save back to package.json
130- jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && mv package.tmp.json package.json && \
131- npm install && \
132- npm run vsce-package && \
133- mv ms-python-envs-insiders.vsix /opt/cs50/extensions && \
134- cd /tmp && \
135- rm --force --recursive vscode-python-environments
106+ # Process each extension: format is "repo-name|build-command|output-filename"
107+ for ext in \
108+ "vscode-python|package|ms-python-insiders.vsix" \
109+ "vscode-python-debugger|vsce-package|python-debugger.vsix" \
110+ "vscode-python-environments|vsce-package|ms-python-envs-insiders.vsix" ; \
111+ do \
112+ IFS='|' read -r repo build_cmd output_file <<< "$ext" && \
113+ # Fetch the latest release tag from GitHub API
114+ echo "Fetching latest release for $repo..." && \
115+ latest_tag=$(curl -s "https://api.github.com/repos/microsoft/$repo/releases/latest" | jq -r .tag_name) && \
116+ echo "Using version: $latest_tag" && \
117+ # Clone the repository at the latest release tag
118+ git clone --branch "$latest_tag" --depth 1 "https://github.com/microsoft/$repo.git" && \
119+ cd "$repo" && \
120+ # Modify package.json to remove the "Run Python File" button from the editor title bar
121+ jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && \
122+ mv package.tmp.json package.json && \
123+ npm install && \
124+ npm run "$build_cmd" && \
125+ mv "$output_file" /opt/cs50/extensions && \
126+ cd /tmp && \
127+ rm --force --recursive "$repo" ; \
128+ done
136129
137130# Final stage
138131FROM cs50/cli:${TAG}
0 commit comments