From ef28071d289acbb62bf9583a087527be1f99af94 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Thu, 28 Nov 2024 18:45:34 -0500 Subject: [PATCH] add nodejs-wheel Signed-off-by: Jinzhe Zeng --- recipes/nodejs-wheel/0001-hack-ROOT_DIR.patch | 25 +++++++++ recipes/nodejs-wheel/meta.yaml | 56 +++++++++++++++++++ recipes/nodejs-wheel/run_test.py | 15 +++++ 3 files changed, 96 insertions(+) create mode 100644 recipes/nodejs-wheel/0001-hack-ROOT_DIR.patch create mode 100644 recipes/nodejs-wheel/meta.yaml create mode 100644 recipes/nodejs-wheel/run_test.py diff --git a/recipes/nodejs-wheel/0001-hack-ROOT_DIR.patch b/recipes/nodejs-wheel/0001-hack-ROOT_DIR.patch new file mode 100644 index 0000000000000..f1fa26278d27c --- /dev/null +++ b/recipes/nodejs-wheel/0001-hack-ROOT_DIR.patch @@ -0,0 +1,25 @@ +From da61816c3a41ffbf8381c04b6df5e4aada262e01 Mon Sep 17 00:00:00 2001 +From: Jinzhe Zeng +Date: Thu, 28 Nov 2024 18:44:21 -0500 +Subject: [PATCH] hack ROOT_DIR + +--- + nodejs_wheel/executable.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/nodejs_wheel/executable.py b/nodejs_wheel/executable.py +index 42f216e..dede038 100644 +--- a/nodejs_wheel/executable.py ++++ b/nodejs_wheel/executable.py +@@ -10,7 +10,7 @@ try: + except ImportError: + from typing_extensions import Literal # type: ignore + +-ROOT_DIR = os.path.dirname(__file__) ++ROOT_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "..", "..") + + + @overload +-- +2.34.1 + diff --git a/recipes/nodejs-wheel/meta.yaml b/recipes/nodejs-wheel/meta.yaml new file mode 100644 index 0000000000000..8649de7f6dd81 --- /dev/null +++ b/recipes/nodejs-wheel/meta.yaml @@ -0,0 +1,56 @@ +{% set name = "nodejs-wheel" %} +{% set version = "22.11.0" %} + +package: + name: {{ name|lower }} + version: {{ version }} + +source: + url: https://github.com/njzjz/nodejs-wheel/archive/v{{ version }}.tar.gz + sha256: 66a58de579f1d2fb64aa021ef324877375beb0b86596d4ddb4edfadcbb714f81 + patches: + - 0001-hack-ROOT_DIR.patch + +build: + noarch: python + number: 0 + script_env: + - SETUPTOOLS_SCM_PRETEND_VERSION={{version}} + - SKBUILD_WHEEL_CMAKE=0 + script: "{{ PYTHON }} -m pip install . -vv" + +requirements: + host: + - python {{ python_min }} + - pip + - scikit-build-core + run: + - python >={{ python_min }} + # unpin nodejs, so downstream packages can control the version + - nodejs + +test: + imports: + - nodejs_wheel + requires: + - python {{ python_min }} + - pip + commands: + - python -m nodejs_wheel --version + - pip check + +about: + home: https://github.com/njzjz/nodejs-wheel + summary: 'Python wrapper for Node.js wheels' + description: | + On PyPI, nodejs-wheel is unoffical Node.js wheels; + on conda-forge, only the Python wrapper is provided. + license: MIT + license_family: MIT + license_file: LICENSE + doc_url: https://github.com/njzjz/nodejs-wheel + dev_url: https://github.com/njzjz/nodejs-wheel + +extra: + recipe-maintainers: + - njzjz diff --git a/recipes/nodejs-wheel/run_test.py b/recipes/nodejs-wheel/run_test.py new file mode 100644 index 0000000000000..22476e676faa8 --- /dev/null +++ b/recipes/nodejs-wheel/run_test.py @@ -0,0 +1,15 @@ +from nodejs_wheel import ( + node, + npm, + npx, +) + + +return_code0 = node(["--version"]) +assert return_code0 == 0 + +return_code1 = npm(["--version"]) +assert return_code1 == 0 + +return_code2 = npx(["--version"]) +assert return_code2 == 0