MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / build_dependency

Function build_dependency

nix/build-all.py:624–788  ·  view source on GitHub ↗

Handles building of dependencies with different tools (which are distinguished with the `mode` argument. `build_tool_args` is expected to be a list which is necessary in order to not mess up quoting of compiler and linker flags. :param pre_compile_subs: A sequence of ``(fn, before,

(
    name: str,
    mode: Literal[
        "cmake",
        "autoconf",
        "ctest",
        "bjam",
    ],
    build_tool_args: "list[str]",
    download_url: str,
    download_name: str,
    download_tool: Literal["py", "git"] = download_tool_default,
    revision: "Union[str, None]" = None,
    patch: "Union[str, list[str], None]" = None,
    shell=None,
    pre_compile_subs: "Sequence[tuple[str, str, str]]" = (),
    additional_files: "Union[dict[str, str], None]" = None,
    no_append_name=False,
    cmake_dir=None,
    **kwargs,
)

Source from the content-addressed store, hash-verified

622
623
624def build_dependency(
625 name: str,
626 mode: Literal[
627 "cmake",
628 "autoconf",
629 "ctest",
630 "bjam",
631 ],
632 build_tool_args: "list[str]",
633 download_url: str,
634 download_name: str,
635 download_tool: Literal["py", "git"] = download_tool_default,
636 revision: "Union[str, None]" = None,
637 patch: "Union[str, list[str], None]" = None,
638 shell=None,
639 pre_compile_subs: "Sequence[tuple[str, str, str]]" = (),
640 additional_files: "Union[dict[str, str], None]" = None,
641 no_append_name=False,
642 cmake_dir=None,
643 **kwargs,
644) -> None:
645 """Handles building of dependencies with different tools (which are
646 distinguished with the `mode` argument. `build_tool_args` is expected to be
647 a list which is necessary in order to not mess up quoting of compiler and
648 linker flags.
649
650 :param pre_compile_subs: A sequence of ``(fn, before, after)``
651 :param additional_files: Mapping path->url.
652 :param kwargs: Additional ``mode`` related kwargs.
653 """
654 check_dir = os.path.join(DEPS_DIR, "install", name)
655 if os.path.exists(check_dir):
656 logger.info(f"Found existing {name}, skipping")
657 return
658 build_dir = os.path.join(DEPS_DIR, "build")
659 if not os.path.exists(build_dir):
660 os.makedirs(build_dir)
661
662 logger.info(f"\rFetching {name}... ")
663
664 if download_tool == download_tool_py:
665 if no_append_name:
666 url = download_url
667 else:
668 url = os.path.join(download_url, download_name)
669
670 download_path = os.path.join(build_dir, download_name)
671 if not os.path.exists(download_path):
672 for _ in range(3):
673 try:
674 urlretrieve(url, os.path.join(build_dir, download_path))
675 break
676 except ConnectionError as e:
677 print(e, "... retrying...")
678 time.sleep(30.0)
679 continue
680 else:
681 logger.info(

Callers 1

build-all.pyFile · 0.85

Calls 14

printFunction · 0.85
run_autoconfFunction · 0.85
run_cmakeFunction · 0.85
openMethod · 0.80
runFunction · 0.70
rangeFunction · 0.50
openFunction · 0.50
joinMethod · 0.45
itemsMethod · 0.45
__str__Method · 0.45
runMethod · 0.45

Tested by

no test coverage detected