Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: onboard onto Python 3.12-dev and Node 18 #201

Merged
merged 16 commits into from
Aug 26, 2023
Merged
24 changes: 19 additions & 5 deletions .github/workflows/node-gyp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python: ["3.8", "3.x"]
python: ["3.8", "3.x", "3.12-dev"]

runs-on: ${{ matrix.os }}
steps:
Expand All @@ -26,11 +26,17 @@ jobs:
path: node-gyp
- uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
- name: Install Python dependencies
run: |
cd gyp-next
python -m pip install --upgrade pip setuptools
pip install --editable .
pip uninstall -y gyp-next
- name: Install Node.js dependencies
run: |
cd node-gyp
npm install --no-progress
Expand All @@ -39,7 +45,15 @@ jobs:
run: |
rm -rf node-gyp/gyp
cp -r gyp-next node-gyp/gyp
- name: Run tests
- name: Run tests (macOS or Linux)
if: runner.os != 'Windows'
shell: bash
run: |
cd node-gyp
npm test --python="${pythonLocation}/python"
- name: Run tests (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd node-gyp
npm test
npm run test --python="${env:pythonLocation}\\python.exe"
4 changes: 2 additions & 2 deletions pylib/gyp/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import sys
import threading
import traceback
from distutils.version import StrictVersion
from gyp.common import GypError
from gyp.common import OrderedSet
from packaging.version import Version

# A list of types that are treated as linkable.
linkable_types = [
Expand Down Expand Up @@ -1180,7 +1180,7 @@ def EvalSingleCondition(cond_expr, true_dict, false_dict, phase, variables, buil
else:
ast_code = compile(cond_expr_expanded, "<string>", "eval")
cached_conditions_asts[cond_expr_expanded] = ast_code
env = {"__builtins__": {}, "v": StrictVersion}
env = {"__builtins__": {}, "v": Version}
if eval(ast_code, env, variables):
return true_dict
return false_dict
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description = "A fork of the GYP build system for use in the Node.js projects"
readme = "README.md"
license = { file="LICENSE" }
requires-python = ">=3.8"
dependencies = ["packaging>=23.1"]
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Console",
Expand Down Expand Up @@ -86,12 +87,15 @@ select = [
# "TRY", # tryceratops
]
ignore = [
"E721",
"PLC1901",
"PLR0402",
"PLR1714",
"PLR2004",
"PLR5501",
"PLW0603",
"PLW2901",
"PYI024",
"RUF005",
"RUF012",
"UP031",
Expand Down