Remove building with NOCRYPTO option
[minix3.git] / external / bsd / libc++ / dist / libcxx / utils / not / not.py
blob96e4ea7eee188899ff77d019e28b26d605d65810
1 """not.py is a utility for inverting the return code of commands.
2 It acts similar to llvm/utils/not.
3 ex: python /path/to/not.py ' echo hello
4 echo $? // (prints 1)
5 """
7 import distutils.spawn
8 import subprocess
9 import sys
12 def main():
13 argv = list(sys.argv)
14 del argv[0]
15 if len(argv) > 0 and argv[0] == '--crash':
16 del argv[0]
17 expectCrash = True
18 else:
19 expectCrash = False
20 if len(argv) == 0:
21 return 1
22 prog = distutils.spawn.find_executable(argv[0])
23 if prog is None:
24 sys.stderr.write('Failed to find program %s' % argv[0])
25 return 1
26 rc = subprocess.call(argv)
27 if rc < 0:
28 return 0 if expectCrash else 1
29 if expectCrash:
30 return 1
31 return rc == 0
34 if __name__ == '__main__':
35 exit(main())