MINGW-packages/mingw-w64-nodejs/0012-Use-shell-wrapper-script-for-npm-on-MSYS2-mingw-w64.patch
2025-07-13 10:57:51 +03:00

44 lines
1.6 KiB
Diff

From 94d3d4f85a245f474091a5e241e249ecbc2c12a1 Mon Sep 17 00:00:00 2001
From: Alexey Pavlov <alexpux@gmail.com>
Date: Thu, 12 Apr 2018 10:20:30 +0200
Subject: [PATCH 12/23] Use shell wrapper script for npm on MSYS2 mingw-w64
---
tools/install.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/tools/install.py b/tools/install.py
index 24c297d6..ca6c441b 100755
--- a/tools/install.py
+++ b/tools/install.py
@@ -109,7 +109,10 @@ def package_files(options, action, name, bins):
if action == uninstall:
action(options, [link_path], os.path.join('bin', bin_name))
elif action == install:
- try_symlink(options, os.path.join('../lib/node_modules', name, bin_target), link_path)
+ if sys.platform == 'win32':
+ try_copy(options, os.path.join('deps/npm/bin', bin_name), link_path)
+ else:
+ try_symlink(options, os.path.join('../lib/node_modules', name, bin_target), link_path)
else:
assert 0 # unhandled action type
@@ -139,6 +142,14 @@ def corepack_files(options, action):
try_symlink(options, '../lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js', link_path)
else:
assert 0 # unhandled action type
+ elif sys.platform == 'win32':
+ link_path = abspath(options.install_path, 'bin/node-gyp')
+ if action == uninstall:
+ action(options, [link_path], 'bin/node-gyp')
+ elif action == install:
+ try_copy(options, 'deps/npm/bin/node-gyp-bin/node-gyp', link_path)
+ else:
+ assert 0 # unhandled action type
def subdir_files(options, path, dest, action):
source_path, _ = mkpaths(options, path, dest)
--
2.17.0.windows.1