Skip to content

Commit

Permalink
update the patch for Windows
Browse files Browse the repository at this point in the history
Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz committed Nov 29, 2024
1 parent b648f91 commit a8818de
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions recipes/nodejs-wheel/0001-hack-ROOT_DIR.patch
Original file line number Diff line number Diff line change
@@ -1,25 +1,48 @@
From da61816c3a41ffbf8381c04b6df5e4aada262e01 Mon Sep 17 00:00:00 2001
From 3c744fcf21d755f393a533df49afdb0c52ce9be3 Mon Sep 17 00:00:00 2001
From: Jinzhe Zeng <[email protected]>
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(-)
nodejs_wheel/executable.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/nodejs_wheel/executable.py b/nodejs_wheel/executable.py
index 42f216e..dede038 100644
index 42f216e..e435399 100644
--- a/nodejs_wheel/executable.py
+++ b/nodejs_wheel/executable.py
@@ -10,7 +10,7 @@ try:
@@ -10,7 +10,12 @@ 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__), "..", "..", "..", "..")
+if os.name == "nt":
+ ROOT_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "..")
+ NODE_MODULES_DIR = os.path.join(ROOT_DIR, "node_modules")
+else:
+ ROOT_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "..", "..")
+ NODE_MODULES_DIR = os.path.join(ROOT_DIR, "lib", "node_modules")


@overload
@@ -179,7 +184,7 @@ def npm(
if args is None:
args = sys.argv[1:]
return call_node(
- os.path.join(ROOT_DIR, "lib", "node_modules", "npm", "bin", "npm-cli.js"),
+ os.path.join(NODE_MODULES_DIR, "npm", "bin", "npm-cli.js"),
*args,
return_completed_process=return_completed_process,
**kwargs,
@@ -233,7 +238,7 @@ def npx(
if args is None:
args = sys.argv[1:]
return call_node(
- os.path.join(ROOT_DIR, "lib", "node_modules", "npm", "bin", "npx-cli.js"),
+ os.path.join(NODE_MODULES_DIR, "npm", "bin", "npx-cli.js"),
*args,
return_completed_process=return_completed_process,
**kwargs,
--
2.34.1

0 comments on commit a8818de

Please sign in to comment.