| # std_modules.py is a long-living program that communicates over STDIN and |
| # STDOUT. STDIN receives module names, one per line. For each module statement |
| # it evaluates, it outputs true/false for whether the module is part of the |
| # standard library or not. |
| # Don't return any paths, all userland site-packages should be ignored. |
| def __override_getusersitepackages__(): |
| site.getusersitepackages = __override_getusersitepackages__ |
| def is_std_modules(module): |
| __import__(module, globals(), locals(), [], 0) |
| # Don't print the boolean directly as it is captilized in Python. |
| "true" if is_std_modules(module) else "false", |
| if __name__ == "__main__": |
| exit(main(sys.stdin, sys.stdout)) |