def _precompile_source(self): source_relpaths = [path for label in ('source', 'executable', 'main', 'bootstrap') for path in self._chroot.filesets.get(label, ()) if path.endswith('.py')] compiler = Compiler(self.interpreter) compiled_relpaths = compiler.compile(self._chroot.path(), source_relpaths) for compiled in compiled_relpaths: self._chroot.touch(compiled, label='bytecode')
def compilation(valid_paths=None, invalid_paths=None, compile_paths=None): with temporary_dir() as root: for path in valid_paths: write_source(os.path.join(root, path)) for path in invalid_paths: write_source(os.path.join(root, path), valid=False) compiler = Compiler(PythonInterpreter.get()) yield root, compiler.compile(root, compile_paths)
def compilation(valid_paths, invalid_paths, compile_paths): # type: (Iterable[str], Iterable[str], Iterable[str]) -> Iterator[Tuple[str, List[Text]]] with temporary_dir() as root: for path in valid_paths: write_source(os.path.join(root, path)) for path in invalid_paths: write_source(os.path.join(root, path), valid=False) compiler = Compiler(PythonInterpreter.get()) yield root, compiler.compile(root, compile_paths)
def _precompile_source(self): source_relpaths = [ path for label in ("source", "executable", "main", "bootstrap") for path in self._chroot.filesets.get(label, ()) if path.endswith(".py") ] compiler = Compiler(self.interpreter) compiled_relpaths = compiler.compile(self._chroot.path(), source_relpaths) for compiled in compiled_relpaths: self._chroot.touch(compiled, label="bytecode")
def _precompile_source(self): source_relpaths = [ path for label in ("source", "executable", "main", "bootstrap") for path in self._chroot.filesets.get(label, ()) if path.endswith(".py") # N.B.: This file if Python 3.6+ only and will not compile under Python 2.7 or # Python 3.5. Since we don't actually use it we just skip compiling it. and path != os.path.join( BOOTSTRAP_DIR, "pex/vendor/_vendored/attrs/attr/_next_gen.py") ] compiler = Compiler(self.interpreter) compiled_relpaths = compiler.compile(self._chroot.path(), source_relpaths) for compiled in compiled_relpaths: self._chroot.touch(compiled, label="bytecode")