Lines Matching refs:self

153     def __init__(self, info: str, text: str):
154 self.info = info
155 self.text = text
157 def __str__(self):
158 return f"{type(self).__name__}: '{self.info}'\n{self.text}"
191 def getenv(self, profile: "BuildProfile") -> dict:
192 return self.environ.copy()
339 def platform(self) -> Platform:
340 if self.is_emscripten:
342 elif self.is_wasi:
348 def is_emscripten(self) -> bool:
349 cls = type(self)
350 return self in {cls.wasm32_emscripten, cls.wasm64_emscripten}
353 def is_wasi(self) -> bool:
354 cls = type(self)
355 return self in {cls.wasm32_wasi, cls.wasm64_wasi}
357 def get_extra_paths(self) -> Iterable[pathlib.PurePath]:
364 cls = type(self)
365 if self == cls.wasm32_emscripten:
367 elif self == cls.wasm64_emscripten:
374 def emport_args(self) -> List[str]:
376 cls = type(self)
377 if self is cls.wasm64_emscripten:
379 elif self is cls.wasm32_emscripten:
385 def embuilder_args(self) -> List[str]:
387 cls = type(self)
388 if self is cls.wasm64_emscripten:
403 def is_browser(self):
404 cls = type(self)
405 return self in {cls.browser, cls.browser_debug}
408 def emport_args(self) -> List[str]:
410 cls = type(self)
411 if self in {cls.browser_debug, cls.node_debug}:
424 def __bool__(self):
425 cls = type(self)
426 return self in {cls.supported, cls.working}
440 def is_browser(self) -> bool:
442 return self.target is not None and self.target.is_browser
445 def builddir(self) -> pathlib.Path:
447 return BUILDDIR / self.name
450 def python_cmd(self) -> pathlib.Path:
452 return self.builddir / self.host.platform.pythonexe
455 def makefile(self) -> pathlib.Path:
457 return self.builddir / "Makefile"
460 def configure_cmd(self) -> List[str]:
464 configure = os.path.relpath(CONFIGURE, self.builddir)
466 platform = self.host.platform
470 cmd.append(f"--host={self.host.value}")
473 if self.target is not None:
474 assert self.host.is_emscripten
475 cmd.append(f"--with-emscripten-target={self.target.value}")
477 if self.dynamic_linking is not None:
478 assert self.host.is_emscripten
479 opt = "enable" if self.dynamic_linking else "disable"
482 if self.pthreads is not None:
483 assert self.host.is_emscripten
484 opt = "enable" if self.pthreads else "disable"
487 if self.host != Host.build:
496 def make_cmd(self) -> List[str]:
499 platform = self.host.platform
504 def getenv(self) -> dict:
508 platenv = self.host.platform.getenv(self)
515 new_path.extend(self.host.get_extra_paths())
520 relbuilddir=self.builddir.relative_to(SRCDIR),
529 self,
537 cwd = self.builddir
542 env=self.getenv(),
545 def _check_execute(self):
546 if self.is_browser:
547 raise ValueError(f"Cannot execute on {self.target}")
549 def run_build(self, *args):
551 if not self.makefile.exists():
553 self.run_configure(*args)
554 self.run_make("all", *args)
556 def run_configure(self, *args):
558 os.makedirs(self.builddir, exist_ok=True)
559 return self._run_cmd(self.configure_cmd, args)
561 def run_make(self, *args):
563 return self._run_cmd(self.make_cmd, args)
565 def run_pythoninfo(self, *args):
567 self._check_execute()
568 return self.run_make("pythoninfo", *args)
570 def run_test(self, target: str, testopts: Optional[str] = None):
572 self._check_execute()
574 testopts = self.default_testopts
575 return self.run_make(target, f"TESTOPTS={testopts}")
577 def run_py(self, *args):
579 self._check_execute()
580 self.run_make(
584 def run_browser(self, bind="127.0.0.1", port=8000):
586 relbuilddir = self.builddir.relative_to(SRCDIR)
615 def clean(self, all: bool = False):
618 if self.builddir.exists():
619 shutil.rmtree(self.builddir)
620 elif self.makefile.exists():
621 self.run_make("clean")
623 def build_emports(self, force: bool = False):
625 platform = self.host.platform
630 embuilder_cmd.extend(self.host.embuilder_args)
635 ports_cmd.extend(self.host.emport_args)
636 if self.target:
637 ports_cmd.extend(self.target.emport_args)
639 if self.dynamic_linking:
644 if self.pthreads:
652 ["build", "bzip2", "sqlite3-mt" if self.pthreads else "sqlite3", "zlib"]
655 self._run_cmd(embuilder_cmd, cwd=SRCDIR)
668 self._run_cmd(ports_cmd, args, cwd=tmppath)