20
20
from tools import shared , utils
21
21
22
22
actions = [
23
- ('npm packages' , 'package.json' , [shutil .which ('npm' ), 'ci' ]),
24
- # TODO(sbc): Remove the checked in entry point files and have them
25
- # built on demand by this step.
26
- ('create entry points' , 'tools/maint/create_entry_points.py' , [sys .executable , 'tools/maint/create_entry_points.py' ]),
27
- ('git submodules' , 'test/third_party/posixtestsuite/' , [shutil .which ('git' ), 'submodule' , 'update' , '--init' ]),
23
+ ('npm packages' , ['package.json' ], [shutil .which ('npm' ), 'ci' ]),
24
+ ('create entry points' , [
25
+ 'tools/maint/create_entry_points.py' ,
26
+ 'tools/maint/run_python.bat' ,
27
+ 'tools/maint/run_python.sh' ,
28
+ 'tools/maint/run_python.ps1' ,
29
+ ],
30
+ [sys .executable , 'tools/maint/create_entry_points.py' ]),
31
+ ('git submodules' , ['test/third_party/posixtestsuite/' ], [shutil .which ('git' ), 'submodule' , 'update' , '--init' ]),
28
32
]
29
33
30
34
31
35
def get_stamp_file (action_name ):
32
36
return os .path .join (STAMP_DIR , action_name .replace (' ' , '_' ) + '.stamp' )
33
37
34
38
39
+ def check_deps (name , deps ):
40
+ stamp_file = get_stamp_file (name )
41
+ if not os .path .exists (stamp_file ):
42
+ return False
43
+ for dep in deps :
44
+ dep = utils .path_from_root (dep )
45
+ if os .path .getmtime (dep ) > os .path .getmtime (stamp_file ):
46
+ return False
47
+ return True
48
+
49
+
35
50
def check ():
36
- for name , filename , _ in actions :
37
- stamp_file = get_stamp_file (name )
38
- filename = utils .path_from_root (filename )
39
- if not os .path .exists (stamp_file ) or os .path .getmtime (filename ) > os .path .getmtime (stamp_file ):
40
- utils .exit_with_error (f'emscripten setup is not complete ("{ name } " is out-of-date). Run bootstrap.py to update' )
51
+ for name , deps , _ in actions :
52
+ if not check_deps (name , deps ):
53
+ utils .exit_with_error (f'emscripten setup is not complete ("{ name } " is out-of-date). Run `bootstrap` to update' )
41
54
42
55
43
56
def main (args ):
@@ -46,13 +59,12 @@ def main(args):
46
59
parser .add_argument ('-n' , '--dry-run' , action = 'store_true' , help = 'dry run' , default = False )
47
60
args = parser .parse_args ()
48
61
49
- for name , filename , cmd in actions :
50
- stamp_file = get_stamp_file (name )
51
- filename = utils .path_from_root (filename )
52
- if os .path .exists (stamp_file ) and os .path .getmtime (filename ) <= os .path .getmtime (stamp_file ):
62
+ for name , deps , cmd in actions :
63
+ if check_deps (name , deps ):
53
64
print ('Up-to-date: %s' % name )
54
65
continue
55
66
print ('Out-of-date: %s' % name )
67
+ stamp_file = get_stamp_file (name )
56
68
if args .dry_run :
57
69
print (' (skipping: dry run) -> %s' % ' ' .join (cmd ))
58
70
return
0 commit comments