Skip to content

Commit e386088

Browse files
committed
Fix windows native module test
1 parent e186411 commit e386088

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

test/sanity/native-module-buffer/test.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,26 @@ def find_executable(executable, path=None):
6969

7070
nw_gyp_path = find_executable('nw-gyp')
7171
npm_path = find_executable('npm')
72+
npm_cmdline = [npm_path, 'install']
73+
74+
if sys.platform in ('win32', 'cygwin'):
75+
nw_gyp_path = os.path.join(os.path.dirname(nw_gyp_path),
76+
'node_modules', 'nw-gyp', 'bin', 'nw-gyp.js')
77+
npm_cmdline = [npm_path, 'install', '--msvs_version=2015']
7278

7379
print "nw_gyp: ", nw_gyp_path
7480
print "npm_path: ", npm_path
7581
print "header path: ", header_path
82+
print "command line: ", npm_cmdline
7683

7784
npm_env = {'npm_config_nodedir': header_path, 'npm_config_target': nw_version,
7885
'npm_config_arch': arch, 'npm_config_target_arch': arch,
7986
'npm_config_runtime': 'node-webkit', 'npm_config_build_from_source': "true",
8087
'npm_config_node_gyp': nw_gyp_path, 'PATH': os.getenv('PATH')}
8188

82-
proc = Popen([npm_path, 'install'], stdout=PIPE, stderr=PIPE, env=npm_env)
89+
os.environ.update(npm_env)
90+
91+
proc = Popen(npm_cmdline, stdout=PIPE, stderr=PIPE, env=os.environ)
8392
out, err = proc.communicate()
8493
print out
8594
print err

tools/make-nw-headers.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
import shutil
88
import distutils.core
99
import re
10+
import argparse
11+
12+
parser = argparse.ArgumentParser(description='Package nw binaries.')
13+
parser.add_argument('-p','--path', help='Where to find the binaries, like out/Release', required=False)
14+
parser.add_argument('-n','--name', help='platform name.', required=False)
15+
args = parser.parse_args()
16+
17+
binaries_location = args.path
18+
platform_name = args.name
1019

1120
def update_uvh(tmp_dir, header_files):
1221
for file in header_files:
@@ -96,3 +105,12 @@ def update_uvh(tmp_dir, header_files):
96105
tar.add(os.path.join(tmp_dir, 'node'), arcname='node')
97106

98107
print 'compress end'
108+
109+
#copy over the nw.lib files so building native modules locally can work later in tests
110+
111+
if platform_name == 'win':
112+
release_dir = os.path.join(tmp_dir, 'node', 'Release')
113+
if not os.path.exists(release_dir):
114+
os.mkdir(release_dir)
115+
shutil.copy(os.path.join(binaries_location, 'nw.lib'), release_dir)
116+
shutil.copy(os.path.join(binaries_location, 'node.lib'), release_dir)

tools/package_binaries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def generate_target_headers(platform_name, arch, version):
295295
make_nw_header = os.path.join(os.path.dirname(__file__), \
296296
'make-nw-headers.py')
297297
print make_nw_header
298-
res = call(['python', make_nw_header])
298+
res = call(['python', make_nw_header, '-p', binaries_location, '-n', platform_name])
299299
if res == 0:
300300
print 'nw-headers generated'
301301
nw_headers_name = 'nw-headers-v' + version + '.tar.gz'

0 commit comments

Comments
 (0)