MCPcopy Create free account
hub / github.com/DFHack/dfhack / main

Function main

ci/script-syntax.py:24–53  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

22
23
24def main(args):
25 root_path = os.path.abspath(args.path)
26 cmd = args.cmd.split(' ')
27 if not os.path.exists(root_path):
28 print('Nonexistent path: %s' % root_path)
29 sys.exit(2)
30 err = False
31 for cur, dirnames, filenames in os.walk(root_path):
32 parts = cur.replace('\\', '/').split('/')
33 if '.git' in parts or 'depends' in parts:
34 continue
35 for filename in filenames:
36 if not filename.endswith('.' + args.ext):
37 continue
38 full_path = os.path.join(cur, filename)
39 try:
40 p = subprocess.Popen(cmd + [full_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
41 _, stderr = p.communicate()
42 stderr = stderr.decode('utf-8', errors='ignore')
43 if stderr:
44 print_stderr(stderr, args)
45 if p.returncode != 0:
46 err = True
47 except subprocess.CalledProcessError:
48 err = True
49 except IOError:
50 if not err:
51 print('Warning: cannot check %s script syntax' % args.ext)
52 err = True
53 sys.exit(int(err))
54
55
56if __name__ == '__main__':

Callers 1

script-syntax.pyFile · 0.70

Calls 4

print_stderrFunction · 0.85
printFunction · 0.50
existsMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected