def test_workers_available_cores(self, compile_dir): with mock.patch("sys.argv", new=[sys.executable, self.directory, "-j0"]): compileall.main() self.assertTrue(compile_dir.called) self.assertEqual(compile_dir.call_args[-1]['workers'], None)
Num(n=node.lineno), Num(n=node.col_offset)], keywords = [], starargs=None, kwargs=None ) copy_location(new_node, node) fix_missing_locations(new_node) return new_node return node old_compile = __builtin__.compile def compile(source, filename, mode, flags=0): # skipping a few parameters # My rewrite code uses ast.parse, which ends up calling this # function with this argument, so pass it back to the real compile. if flags == PyCF_ONLY_AST: return old_compile(source, filename, mode, flags) assert mode == "exec" #traceback.print_stack() code = open(filename).read() tree = parse(code, filename) tree = RewriteInterpolation(filename).visit(tree) code = old_compile(tree, filename, "exec") return code # Ugly hack so I can force compileall to use my compile function. __builtin__.compile = compile exit_status = int(not compileall.main()) sys.exit(exit_status)
def test_workers_available_cores(self, compile_dir): with mock.patch("sys.argv", new=[sys.executable, self.directory, "-j0"]): compileall.main() self.assertTrue(compile_dir.called) self.assertEqual(compile_dir.call_args[-1]['workers'], 0)
def main(): exit_status = int(not compileall.main()) sys.exit(exit_status)
def update_event(self, inp=-1): self.set_output_val(0, compileall.main())
win32api.RegCloseKey(uihandle) print "Registering Python Interpreter as shell for *.py files..." pwd = nt.getcwd() interpreter = '"%s\\Bin\\python.exe" -i "%%1"' % pwd print "Interpreter command is", interpreter root = win32con.HKEY_CLASSES_ROOT sz = win32con.REG_SZ win32api.RegSetValue(root, ".py", sz, "Python.Script") win32api.RegSetValue(root , "Python.Script", sz, "Python Script") win32api.RegSetValue(root , "Python.Script\\Shell\\Open\\Command", sz, interpreter) import compileall print "Compiling all library modules..." compileall.main() print "Installation complete." envkeys = map(strop.upper, nt.environ.keys()) if 'PYTHONPATH' in envkeys: print """ ********************************************************************** WARNING! You have set the environment variable PYTHONPATH. This will override the default Python module search path and probably cause you to use an old or broken Python installation. Go into your control panel *now* and delete PYTHONPATH! ********************************************************************** """
def run(): import compileall sys.argv = ['nsis', '-f', '-x', 'badsyntax', INSTDIR+'\\Lib'] sys.stdout = sys.stderr = NSISStream() compileall.main()