Skip to content

Commit

Permalink
Introduce python as a system dependency which is needed by node-gyp t…
Browse files Browse the repository at this point in the history
…o compile native modules
  • Loading branch information
vraravam committed Mar 23, 2024
1 parent 98eeafd commit f53ffea
Show file tree
Hide file tree
Showing 8 changed files with 224 additions and 40 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Use python specified in the '.python-version' file
uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
cache: 'pip'
- name: Install node dependencies
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, '[nightly branch]')) }}
uses: nick-fields/retry@v3
Expand Down Expand Up @@ -177,6 +182,11 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Use python specified in the '.python-version' file
uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
cache: 'pip'
- name: Install node dependencies
uses: nick-fields/retry@v3
with:
Expand Down Expand Up @@ -256,6 +266,11 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Use python specified in the '.python-version' file
uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
cache: 'pip'
- name: Install node dependencies
uses: nick-fields/retry@v3
with:
Expand Down Expand Up @@ -356,6 +371,11 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Use python specified in the '.python-version' file
uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
cache: 'pip'
#TODO - Remove this once https://github.com/electron-userland/electron-builder/issues/6933#issuecomment-1213438889 is resolved
- name: Tweak pnpm.cjs
run: |
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11.8
9 changes: 5 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- [How can I contribute?](#how-can-i-contribute)
- [Setting up your development machine](#setting-up-your-development-machine)
- [Install system-level dependencies](#install-system-level-dependencies)
- [Node.js, pnpm](#nodejs-pnpm)
- [Node.js, pnpm, python](#nodejs-pnpm-python)
- [Git](#git)
- [On Debian/Ubuntu](#on-debianubuntu)
- [On Fedora](#on-fedora)
Expand Down Expand Up @@ -52,7 +52,7 @@ If so, engage in the already existing discussion.

_Note:_ This list can likely get outdated. If so, please refer to the specific version of the [electronuserland builder](https://hub.docker.com/r/electronuserland/builder) that we use in our [Dockerfile](./Dockerfile).

#### Node.js, pnpm
#### Node.js, pnpm, python

Please make sure you are conforming to the `engines` requirements used by the developers/contributors as specified in the [`package.json`](./package.json#engines) and [`recipes/package.json`](./recipes/package.json#engine) files.

Expand All @@ -63,11 +63,12 @@ Currently, these are the combinations of system dependencies that work for MacOS
$ jq --null-input '[inputs.engines] | add' < ./package.json < ./recipes/package.json
{
"node": "20.11.1",
"pnpm": "8.15.5"
"pnpm": "8.15.5",
"python": "3.11.8"
}
```

_Note:_ You can choose any version manager to manage multiple versions of `node` and `pnpm`. For eg, [nvm](https://github.com/nvm-sh/nvm) or [asdf](https://github.com/asdf-vm/asdf).
_Note:_ You can choose any version manager to manage multiple versions of `node` and `pnpm`. For eg, [nvm](https://github.com/nvm-sh/nvm) or [mise](https://github.com/jdx/mise).

#### Git

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ARG PREVAL_BUILD_INFO_PLACEHOLDERS=true

# Note: 'fpm' is needed for building on ARM machines
RUN apt-get update -y \
&& apt-get install --no-install-recommends -y rpm ruby gem \
&& apt-get install --no-install-recommends -y python3 rpm ruby gem \
&& gem install dotenv -v 2.8.1 --no-ri --no-rdoc --no-document \
&& gem install fpm --no-ri --no-rdoc --no-document

Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
"private": true,
"engines": {
"node": "20.11.1",
"pnpm": "8.15.5"
"pnpm": "8.15.5",
"python": "3.11.8"
},
"engine-strict": true,
"volta": {
"node": "20.11.1",
"pnpm": "8.15.5"
"pnpm": "8.15.5",
"python": "3.11.8"
},
"packageManager": "pnpm@8.15.5",
"scripts": {
Expand Down Expand Up @@ -187,6 +189,7 @@
"husky": "9.0.11",
"is-ci": "3.0.1",
"jest": "29.7.0",
"node-gyp": "10.0.1",
"prettier": "3.2.5",
"preval-build-info": "1.0.3",
"rimraf": "5.0.5",
Expand Down

0 comments on commit f53ffea

Please sign in to comment.