forked from adamlaska/electron
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrebuild-test-modules.py
More file actions
executable file
·64 lines (48 loc) · 1.96 KB
/
rebuild-test-modules.py
File metadata and controls
executable file
·64 lines (48 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
import argparse
import os
import shutil
import subprocess
import sys
from lib.config import PLATFORM, enable_verbose_mode, get_target_arch
from lib.util import execute_stdout, get_electron_version, safe_mkdir, \
update_node_modules, update_electron_modules
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
def main():
os.chdir(SOURCE_ROOT)
args = parse_args()
config = args.configuration
if args.verbose:
enable_verbose_mode()
spec_modules = os.path.join(SOURCE_ROOT, 'spec', 'node_modules')
out_dir = os.path.join(SOURCE_ROOT, 'out', config)
version = get_electron_version()
node_dir = os.path.join(out_dir, 'node-{0}'.format(version))
# Create node headers
script_path = os.path.join(SOURCE_ROOT, 'script', 'create-node-headers.py')
execute_stdout([sys.executable, script_path, '--version', version,
'--directory', out_dir])
if PLATFORM == 'win32':
lib_dir = os.path.join(node_dir, 'Release')
safe_mkdir(lib_dir)
iojs_lib = os.path.join(lib_dir, 'iojs.lib')
atom_lib = os.path.join(out_dir, 'node.dll.lib')
shutil.copy2(atom_lib, iojs_lib)
# Native modules can only be compiled against release builds on Windows
if config[0] == 'R' or PLATFORM != 'win32':
update_electron_modules(os.path.dirname(spec_modules), get_target_arch(),
node_dir)
else:
update_node_modules(os.path.dirname(spec_modules))
def parse_args():
parser = argparse.ArgumentParser(description='Rebuild native test modules')
parser.add_argument('-v', '--verbose',
action='store_true',
help='Prints the output of the subprocesses')
parser.add_argument('-c', '--configuration',
help='Build configuration to rebuild modules against',
default='D',
required=False)
return parser.parse_args()
if __name__ == '__main__':
sys.exit(main())