Skip to content

Commit 47ee877

Browse files
committed
Fix node-gyp distutils: use Python 3.11 via setup-python + npm_config_python
1 parent e1a4239 commit 47ee877

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,46 +51,54 @@ jobs:
5151
sudo apt-get install -y --no-install-recommends \
5252
libgtk-3-dev libglib2.0-dev fuse libfuse2 rpm
5353
54-
# ── Python setuptools (distutils shim for Python 3.12+) ─────────────────
55-
# node-gyp uses distutils.version.StrictVersion which was removed in
56-
# Python 3.12. Installing setuptools restores the distutils shim.
57-
- name: Install setuptools for node-gyp
58-
run: pip install setuptools
54+
# ── Python 3.11 for node-gyp ─────────────────────────────────────────────
55+
# distutils was removed in Python 3.12. node-gyp (used to rebuild
56+
# node-pty) still needs it. Using Python 3.11 avoids the issue entirely.
57+
# npm_config_python tells node-gyp exactly which Python to use.
58+
- name: Set up Python 3.11 for node-gyp
59+
uses: actions/setup-python@v5
60+
with:
61+
python-version: '3.11'
5962

6063
# ── Install npm dependencies ─────────────────────────────────────────────
6164
- name: Install npm dependencies
6265
working-directory: electron
6366
run: npm install
67+
env:
68+
npm_config_python: python
6469

6570
# ── Build ────────────────────────────────────────────────────────────────
6671
- name: Build (Linux)
6772
if: matrix.platform == 'linux'
6873
working-directory: electron
6974
run: npm run build-linux
7075
env:
71-
# Disable code-signing; we ship unsigned builds
7276
CSC_IDENTITY_AUTO_DISCOVERY: false
77+
npm_config_python: python
7378

7479
- name: Build (Windows)
7580
if: matrix.platform == 'windows'
7681
working-directory: electron
7782
run: npm run build-win
7883
env:
7984
CSC_IDENTITY_AUTO_DISCOVERY: false
85+
npm_config_python: python
8086

8187
- name: Build (macOS Intel)
8288
if: matrix.platform == 'macos-intel'
8389
working-directory: electron
8490
run: npm run build-mac
8591
env:
8692
CSC_IDENTITY_AUTO_DISCOVERY: false
93+
npm_config_python: python
8794

8895
- name: Build (macOS ARM)
8996
if: matrix.platform == 'macos-arm'
9097
working-directory: electron
9198
run: npm run build-mac
9299
env:
93100
CSC_IDENTITY_AUTO_DISCOVERY: false
101+
npm_config_python: python
94102

95103
# ── Upload artifact for debugging ────────────────────────────────────────
96104
- name: Upload build artifact

0 commit comments

Comments
 (0)