Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: compile

Issue 29390657: Issue 5020 - Part 2: Fix usage of paths in compile script (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Created March 21, 2017, 11:22 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 import os 3 import os
4 import re 4 import re
5 import subprocess 5 import subprocess
6 6
7 EMSCRIPTEN_PATH = '../emscripten' 7 BASE_DIR = os.path.dirname(__file__) or os.getcwd()
Vasily Kuznetsov 2017/03/21 18:01:42 BASE_DIR (which I suppose is the path to the direc
Wladimir Palant 2017/03/22 08:44:20 It's fine to have relative paths for almost all pu
Vasily Kuznetsov 2017/03/22 09:52:58 I guess I'm missing some part of the picture here.
Wladimir Palant 2017/03/22 14:59:29 See SHELL_FILE key in GENERATION_PARAMS below. It
Vasily Kuznetsov 2017/03/22 19:16:01 Ah, ok, now I get it. But then we don't really nee
Wladimir Palant 2017/03/23 11:55:28 Fair enough, I verified that os.path.join('', 'foo
8 SOURCE_DIR = './compiled' 8 EMSCRIPTEN_PATH = os.path.join(BASE_DIR, '..', 'emscripten')
9 SOURCE_DIR = os.path.join(BASE_DIR, 'compiled')
9 SOURCE_FILES = [ 10 SOURCE_FILES = [
10 os.path.join(path, f) 11 os.path.join(path, f)
11 for (path, dirs, files) in os.walk(SOURCE_DIR) 12 for (path, dirs, files) in os.walk(SOURCE_DIR)
12 for f in files 13 for f in files
13 if f.endswith('.cpp') 14 if f.endswith('.cpp')
14 ] 15 ]
15 BINDINGS_FILE = os.path.join(SOURCE_DIR, 'bindings.cpp') 16 BINDINGS_FILE = os.path.join(SOURCE_DIR, 'bindings.cpp')
16 BINDINGS_GENERATOR = os.path.join(SOURCE_DIR, 'bindings.cpp.js') 17 BINDINGS_GENERATOR = os.path.join(SOURCE_DIR, 'bindings.cpp.js')
17 BINDINGS_OUTPUT = os.path.join(SOURCE_DIR, 'bindings.js') 18 BINDINGS_OUTPUT = os.path.join(SOURCE_DIR, 'bindings.js')
18 COMPILER_OUTPUT = './lib/compiled.js' 19 COMPILER_OUTPUT = os.path.join(BASE_DIR, 'lib', 'compiled.js')
19 GENERATION_PARAMS = { 20 GENERATION_PARAMS = {
20 'SHELL_FILE': "'%s'" % os.path.abspath(os.path.join(SOURCE_DIR, 21 'SHELL_FILE': "'%s'" % os.path.abspath(os.path.join(SOURCE_DIR,
21 'shell.js')), 22 'shell.js')),
22 'ASM_JS': 2, # "almost asm" 23 'ASM_JS': 2, # "almost asm"
23 'TOTAL_MEMORY': 16*1024*1024, 24 'TOTAL_MEMORY': 16*1024*1024,
24 'TOTAL_STACK': 1*1024*1024, 25 'TOTAL_STACK': 1*1024*1024,
25 'ALLOW_MEMORY_GROWTH': 1, 26 'ALLOW_MEMORY_GROWTH': 1,
26 'NO_EXIT_RUNTIME': 1, 27 'NO_EXIT_RUNTIME': 1,
27 'NO_DYNAMIC_EXECUTION': 1, 28 'NO_DYNAMIC_EXECUTION': 1,
28 'NO_FILESYSTEM': 1, 29 'NO_FILESYSTEM': 1,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 for key, value in GENERATION_PARAMS.iteritems(): 77 for key, value in GENERATION_PARAMS.iteritems():
77 params.extend(['-s', '%s=%s' % (key, str(value))]) 78 params.extend(['-s', '%s=%s' % (key, str(value))])
78 params.extend(ADDITIONAL_PARAMS) 79 params.extend(ADDITIONAL_PARAMS)
79 subprocess.check_call(params, env=env) 80 subprocess.check_call(params, env=env)
80 81
81 82
82 if __name__ == '__main__': 83 if __name__ == '__main__':
83 env = getenv() 84 env = getenv()
84 generate_bindings(env) 85 generate_bindings(env)
85 run_compiler(env) 86 run_compiler(env)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld