Beispiel #1
0
def _get_builder():
    ###
    # Output collected recipe information in the builds logs
    ###
    recipe_is_installer = is_installer()
    printer.print_message(
        "Is the package an installer for executable(s)? {}".format(
            str(recipe_is_installer)))

    if not recipe_is_installer:
        recipe_is_unconditional_header_only = is_unconditional_header_only()
        printer.print_message("Is the package header only? {}".format(
            str(recipe_is_unconditional_header_only)))

        if not recipe_is_unconditional_header_only:
            recipe_is_conditional_header_only = is_conditional_header_only()
            printer.print_message(
                "Is the package conditionally header only ('header_only' option)? {}"
                .format(str(recipe_is_conditional_header_only)))

            recipe_is_pure_c = is_pure_c()
            printer.print_message("Is the package C-only? {}".format(
                str(recipe_is_pure_c)))

    _flush_output()

    ###
    # Create builder
    ###
    kwargs = {}

    if autodetect_directory_structure() == DIR_STRUCTURE_ONE_RECIPE_MANY_VERSIONS \
            or autodetect_directory_structure() == DIR_STRUCTURE_CCI:
        kwargs["stable_branch_pattern"] = os.getenv(
            "CONAN_STABLE_BRANCH_PATTERN", "main")

    if recipe_is_installer:
        arch = os.getenv("ARCH", "x86_64")
        builder = build_shared.get_builder(**kwargs)
        builder.add({
            "os": get_os(),
            "arch_build": arch,
            "arch": arch
        }, {}, {}, {})
    elif recipe_is_unconditional_header_only:
        builder = build_shared.get_builder(**kwargs)
        builder.add()
    else:
        builder = _get_default_builder(pure_c=recipe_is_pure_c, **kwargs)

    return builder
Beispiel #2
0
def run_autodetect():
    has_custom_build_py, custom_build_py_path = is_custom_build_py_existing()

    if has_custom_build_py:
        printer.print_message("Custom build.py detected. Executing ...")
        _flush_output()
        subprocess.run(["python",  "{}".format(custom_build_py_path)], check=True)
        return

    recipe_is_installer = is_installer()
    printer.print_message("Is the package an installer for executable(s)? {}"
                          .format(str(recipe_is_installer)))

    if not recipe_is_installer:
        recipe_is_unconditional_header_only = is_unconditional_header_only()
        printer.print_message("Is the package header only? {}"
                              .format(str(recipe_is_unconditional_header_only)))

        if not recipe_is_unconditional_header_only:
            recipe_is_conditional_header_only = is_conditional_header_only()
            printer.print_message("Is the package conditionally header only ('header_only' option)? {}"
                                  .format(str(recipe_is_conditional_header_only)))

            recipe_is_pure_c = is_pure_c()
            printer.print_message("Is the package C-only? {}".format(str(recipe_is_pure_c)))

    _flush_output()

    if recipe_is_installer:
        arch = os.getenv("ARCH", "x86_64")
        builder = build_template_installer.get_builder()
        builder.add({"os": get_os(), "arch_build": arch, "arch": arch}, {}, {}, {})
        builder.run()
    elif recipe_is_unconditional_header_only:
        builder = build_template_header_only.get_builder()
        builder.run()
    else:
        builder = build_template_default.get_builder(pure_c=recipe_is_pure_c)
        builder.run()
Beispiel #3
0
#!/usr/bin/env python

from bincrafters import build_template_default, build_template_installer, build_shared
import os

if __name__ == "__main__":
    if "CONAN_CONANFILE" in os.environ and os.environ["CONAN_CONANFILE"] == "conanfile_installer.py":
        arch = os.environ["ARCH"]
        builder = build_template_installer.get_builder()
        builder.add({"os": build_shared.get_os(), "arch_build": arch, "arch": arch}, {}, {}, {})
        builder.run()
    else:
        builder = build_template_default.get_builder(pure_c=True)
        builder.run()
Beispiel #4
0
def add_required_installers(build):
    installers = ['nasm_installer/2.13.02@bincrafters/stable']
    if build_shared.get_os() == "Windows":
        installers.append('msys2_installer/latest@bincrafters/stable')
    build.build_requires.update({"*": installers})
    return build
Beispiel #5
0
from bincrafters import build_template_default, build_template_installer, build_shared
import copy
import os

if __name__ == "__main__":
    docker_entry_script = ".ci/entry.sh"

    if "CONAN_CONANFILE" in os.environ and os.environ[
            "CONAN_CONANFILE"] == "conanfile_installer.py":
        arch = os.environ["ARCH"]
        builder = build_template_installer.get_builder(
            docker_entry_script=docker_entry_script)
        builder.add(
            {
                "os": build_shared.get_os(),
                "arch_build": arch,
                "arch": arch
            }, {}, {}, {})
        builder.run()
    else:
        builder = build_template_default.get_builder(
            docker_entry_script=docker_entry_script)

        # Add build combinations needed for conan-sqlitecpp
        builds = list(builder.items)

        new_builds_1 = copy.deepcopy(builds)
        new_builds_2 = copy.deepcopy(builds)

        for build in new_builds_1:
Beispiel #6
0
#!/usr/bin/env python

from bincrafters import build_template_installer, build_shared
import os

if __name__ == "__main__":

    arch = os.environ["ARCH"]
    builder = build_template_installer.get_builder()
    settings = {"os": build_shared.get_os(), "arch_build": arch, "arch": arch}
    build_requires = {}
    if "MINGW_CONFIGURATIONS" in os.environ:
        [version, m_arch, exc,
         threads] = os.environ["MINGW_CONFIGURATIONS"].split("@")
        assert arch == m_arch
        settings.update({
            "compiler": "gcc",
            "compiler.version": version,
            "compiler.exception": exc,
            "compiler.threads": threads,
            "compiler.libcxx": "libstdc++",
        })
        build_requires.setdefault(
            "*", []).append("mingw_installer/1.0@conan/stable")
    builder.add(settings, {}, {}, build_requires)
    builder.run()
def test_get_os():
    expected_os = platform.system()
    assert expected_os == build_shared.get_os()
Beispiel #8
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from bincrafters import build_template_default, build_shared
import platform
import os

if __name__ == "__main__":

    builder = build_template_default.get_builder(pure_c=True)

    for settings, options, env_vars, build_requires, reference in builder.items:
        installers = ["nasm_installer/2.13.02@bincrafters/stable"]
        if build_shared.get_os() == "Windows":
            installers.append("cygwin_installer/2.9.0@bincrafters/stable")
            if os.getenv('MINGW_CONFIGURATIONS', ''):
                installers.append("mingw_installer/1.0@conan/stable")
        build_requires.update({"*": installers})

    builder.run()
Beispiel #9
0
def test_get_os():
    expected_os = "Macos" if platform.system(
    ) == "Darwin" else platform.system()
    assert expected_os == build_shared.get_os()
Beispiel #10
0
from bincrafters import build_template_installer, build_shared
import os

if __name__ == "__main__":
    arch = os.environ["ARCH"]

    builder = build_template_installer.get_builder()

    # Copy default settings.compiler.* and build_requires
    builder.add_common_builds()
    builds = builder.items
    compiler_props = {
        k: v
        for (
            k,
            v,
        ) in builds[0].settings.items() if k.startswith("compiler")
    }
    build_requires = builds[0].build_requires
    builder.items = []

    builder.add(settings={
        "os_build": build_shared.get_os(),
        "arch_build": arch,
        "os": build_shared.get_os(),
        "arch": arch,
        **compiler_props
    },
                build_requires=build_requires)
    builder.run()
Beispiel #11
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from bincrafters import build_template_installer
from bincrafters import build_shared
import os

os.environ["CONAN_UPLOAD_ONLY_WHEN_STABLE"] = ""

if __name__ == "__main__":

    builder = build_template_installer.get_builder()
    builder.add({"os": build_shared.get_os(), "arch": "x86"}, {}, {}, {})
    builder.add({"os": build_shared.get_os(), "arch": "x86_64"}, {}, {}, {})
    builder.run()
Beispiel #12
0
def run_autodetect():
    ###
    # Enabling Conan download cache
    ###
    printer.print_message("Enabling Conan download cache ...")

    tmpdir = os.path.join(tempfile.gettempdir(), "conan")

    os.makedirs(tmpdir, mode=0o777)
    # In some cases Python may ignore the mode of makedirs, do it again explicitly with chmod
    os.chmod(tmpdir, mode=0o777)

    os.system('conan config set storage.download_cache="{}"'.format(tmpdir))
    os.system('conan config set general.revisions_enabled=1')
    os.environ["CONAN_DOCKER_ENTRY_SCRIPT"] =\
        "conan config set storage.download_cache='{}'; conan config set general.revisions_enabled=1".format(tmpdir)
    os.environ["CONAN_DOCKER_RUN_OPTIONS"] = "-v '{}':'/tmp/conan'".format(tmpdir)

    ###
    # Enabling installing system_requirements
    ###
    os.environ["CONAN_SYSREQUIRES_MODE"] = "enabled"

    ###
    # Detect and execute custom build.py file if existing
    ###
    has_custom_build_py, custom_build_py_path = is_custom_build_py_existing()

    if has_custom_build_py:
        printer.print_message("Custom build.py detected. Executing ...")
        _flush_output()

        new_wd = os.path.dirname(custom_build_py_path)
        if new_wd == "":
            new_wd = ".{}".format(os.sep)

        # build.py files have no knowledge about the directory structure above them.
        # Delete the env variable or BPT is appending the path a second time
        # when build.py calls BPT
        if "BPT_CWD" in os.environ:
            del os.environ["BPT_CWD"]

        subprocess.run("python build.py", cwd=new_wd, shell=True, check=True)
        return

    ###
    # Output collected recipe information in the builds logs
    ###
    recipe_is_installer = is_installer()
    printer.print_message("Is the package an installer for executable(s)? {}"
                          .format(str(recipe_is_installer)))

    if not recipe_is_installer:
        recipe_is_unconditional_header_only = is_unconditional_header_only()
        printer.print_message("Is the package header only? {}"
                              .format(str(recipe_is_unconditional_header_only)))

        if not recipe_is_unconditional_header_only:
            recipe_is_conditional_header_only = is_conditional_header_only()
            printer.print_message("Is the package conditionally header only ('header_only' option)? {}"
                                  .format(str(recipe_is_conditional_header_only)))

            recipe_is_pure_c = is_pure_c()
            printer.print_message("Is the package C-only? {}".format(str(recipe_is_pure_c)))

    _flush_output()

    ###
    # Start the build
    ###
    kwargs = {}

    if autodetect_directory_structure() == DIR_STRUCTURE_ONE_RECIPE_MANY_VERSIONS \
            or autodetect_directory_structure() == DIR_STRUCTURE_CCI:
        kwargs["stable_branch_pattern"] = os.getenv("CONAN_STABLE_BRANCH_PATTERN", "main")

    if recipe_is_installer:
        arch = os.getenv("ARCH", "x86_64")
        builder = build_template_installer.get_builder(**kwargs)
        builder.add({"os": get_os(), "arch_build": arch, "arch": arch}, {}, {}, {})
        builder.run()
    elif recipe_is_unconditional_header_only:
        builder = build_template_header_only.get_builder(**kwargs)
        builder.run()
    else:
        builder = build_template_default.get_builder(pure_c=recipe_is_pure_c, **kwargs)
        builder.run()