示例#1
0
def GetDependencies():
    """
    Returns information about the dependencies required by this repository.

    The return value should be an OrderedDict if the repository supports multiple configurations
    (aka is configurable) or a single Configuration if not.
    """

    configurations = OrderedDict()

    configurations["python36"] = Configuration(
        "Python v3.6.5",
        [
            Dependency(
                "0EAA1DCF22804F90AD9F5A3B85A5D706",
                "Common_Environment",
                "python36",
                "https://github.com/davidbrownell/Common_Environment-v3.git",
            ),
        ],
    )

    configurations["python27"] = Configuration(
        "Python v2.7.14",
        [
            Dependency(
                "0EAA1DCF22804F90AD9F5A3B85A5D706",
                "Common_Environment",
                "python27",
                "https://github.com/davidbrownell/Common_Environment-v3.git",
            ),
        ],
    )
    return configurations
示例#2
0
def GetDependencies():
    """
    Returns information about the dependencies required by this repository.

    The return value should be an OrderedDict if the repository supports multiple configurations
    (aka is configurable) or a single Configuration if not.
    """

    d = OrderedDict()

    if CurrentShell.CategoryName == "Windows":
        architectures = ["x64", "x86"]
    else:
        # Cross compiling on Linux is much more difficult on Linux than it is on
        # Windows. Only support the current architecture.
        architectures = [CurrentShell.Architecture]

    for key_suffix, desc_suffix in [
        (None, None),
        ("ex", "Augmented with an external linker"),
    ]:
        for architecture in architectures:
            if key_suffix is None:
                key = architecture
                desc = architecture
            else:
                key = "{}_{}".format(architecture, key_suffix)
                desc = "{} <{}>".format(architecture, desc_suffix)

            d[key] = Configuration(
                desc,
                [
                    Dependency(
                        "2CCC7E3E3C004A05AA384AF378246EAA",
                        "Common_cpp_Clang_Common", key,
                        "https://github.com/davidbrownell/Common_cpp_Clang_Common.git"
                    )
                ],
                VersionSpecs(
                    [],
                    {"Python": [VersionInfo("clang", "v10.0.0")]},
                ),
            )

    d["python"] = Configuration(
        "Support for Clang Python bindings",
        [
            Dependency(
                "0EAA1DCF22804F90AD9F5A3B85A5D706", "Common_Environment",
                "python36",
                "https://github.com/davidbrownell/Common_Environment_v3.git")
        ],
    )

    return d
示例#3
0
def GetDependencies():
    """
    Returns information about the dependencies required by this repository.

    The return value should be an OrderedDict if the repository supports multiple configurations
    (aka is configurable) or a single Configuration if not.
    """

    d = OrderedDict()

    if CurrentShell.CategoryName == "Windows":
        architectures = ["x64", "x86"]
    else:
        # Cross compiling on Linux is much more difficult on Linux than it is on
        # Windows. Only support the current architecture.
        architectures = [CurrentShell.Architecture]

    for architecture in architectures:
        d[architecture] = Configuration(
            architecture,
            [
                Dependency(
                    "0EAA1DCF22804F90AD9F5A3B85A5D706",
                    "Common_Environment",
                    "python36",
                    "https://github.com/davidbrownell/Common_Environment_v3.git",
                )
            ],
        )

    return d
def GetDependencies():
    """
    Returns information about the dependencies required by this repository.

    The return value should be an OrderedDict if the repository supports multiple configurations
    (aka is configurable) or a single Configuration if not.
    """

    return OrderedDict([ ( "python36", Configuration( "Python 3.6.5",
                                                      [],
                                                      VersionSpecs( [ VersionInfo("Python", "v3.6.5"), ],
                                                                    {},
                                                                  ),
                                                    ) ),
                         ( "python27", Configuration( "Python 2.7.14",
                                                      [],
                                                      VersionSpecs( [ VersionInfo("Python", "v2.7.14"), ],
                                                                    {},
                                                                  ),
                                                    ) ),
                       ])
示例#5
0
def GetDependencies():
    """
    Returns information about the dependencies required by this repository.

    The return value should be an OrderedDict if the repository supports multiple configurations
    (aka is configurable) or a single Configuration if not.
    """

    d = OrderedDict()

    if CurrentShell.CategoryName == "Windows":
        architectures = ["x64", "x86"]

        compiler_infos = [
            ("MSVC_2019", "AB7D87C49C2449F79D9F42E5195030FD", None),
            ("Clang_10", "42DE100A1DAE4FFC9697F75566C63DEB", "_ex"),
        ]
    else:
        architectures = [CurrentShell.Architecture]

        compiler_infos = [
            ("Clang_10", "42DE100A1DAE4FFC9697F75566C63DEB", "_ex"),
        ]

    for compiler, compiler_id, configuration_suffix in compiler_infos:
        for architecture in architectures:
            d["{}_{}".format(compiler, architecture)] = Configuration(
                "{} [{}]".format(compiler, architecture),
                [
                    Dependency(
                        compiler_id,
                        "Common_cpp_{}".format(compiler),
                        "{}{}".format(architecture, configuration_suffix or ""),
                        "https://github.com/davidbrownell/Common_cpp_{}.git".format(compiler),
                    ),
                    Dependency(
                        "2B1EBD87C47E495B9330C0304D461141",
                        "Common_cpp_boost_Helpers",
                        "1.70.0_{}_{}{}".format(
                            compiler,
                            architecture,
                            configuration_suffix or "",
                        ),
                        "https://github.com/davidbrownell/Common_cpp_boost_Helpers.git",
                    ),
                ],
            )

    return d
def GetDependencies():
    """
    Returns information about the dependencies required by this repository.

    The return value should be an OrderedDict if the repository supports multiple configurations
    (aka is configurable) or a single Configuration if not.
    """

    d = OrderedDict()

    if CurrentShell.CategoryName == "Windows":
        for architecture in ["x64", "x86"]:
            d[architecture] = Configuration(
                architecture,
                [
                    Dependency(
                        "1DE864025F92429BB9855594DBA732B3",
                        "Common_cpp_MSVC_WindowsKits_10",
                        architecture,
                        "https://github.com/davidbrownell/Common_cpp_MSVC_WindowsKits_10.git",
                    ),
                    Dependency(
                        "F33C43DA6BB54336A7573B39509CDAD7",
                        "Common_cpp_Common",
                        architecture,
                        "https://github.com/davidbrownell/Common_cpp_Common.git",
                    ),
                ],
            )

    d["noop"] = Configuration(
        "Configuration that doesn't do anything; this is useful on non-Windows machines or in Bootstrap repositories (where different versions of MSVC conflict with each other (normally, MSVC repositories are mutually exclusive))",
        [Dependency("0EAA1DCF22804F90AD9F5A3B85A5D706", "Common_Environment", "python36", "https://github.com/davidbrownell/Common_Environment_v3.git")],
    )

    return d
示例#7
0
def GetDependencies():
    """
    Returns information about the dependencies required by this repository.

    The return value should be an OrderedDict if the repository supports multiple configurations
    (aka is configurable) or a single Configuration if not.
    """

    return Configuration(
        "Builds the grammar used by SimpleSchemaGenerator",
        [
            Dependency("9F6DB1C5041945F585C2C5F8557A2483", "Common_ANTLR",
                       None,
                       "https://github.com/davidbrownell/Common_ANTLR-v3.git")
        ],
    )
示例#8
0
def GetDependencies():
    """
    Returns information about the dependencies required by this repository.

    The return value should be an OrderedDict if the repository supports multiple configurations
    (aka is configurable) or a single Configuration if not.
    """

    return Configuration(
        "Contains code that operates on SimpleSchema files",
        [
            Dependency(
                "3C72E8CD41EB483A891F01DDA606B780", "Common_EnvironmentEx",
                "python36",
                "https://github.com/davidbrownell/Common_EnvironmentEx.git")
        ],
    )
def GetDependencies():
    """
    Returns information about the dependencies required by this repository.

    The return value should be an OrderedDict if the repository supports multiple configurations
    (aka is configurable) or a single Configuration if not.
    """

    return Configuration(
        "Standard Build Environment",
        [
            Dependency(
                "5C7E1B3369B74BC098141FAD290288DA",
                "Common_SimpleSchemaGenerator",
                None,
                "https://github.com/davidbrownell/Common_SimpleSchemaGenerator.git",
            ),
        ],
    )
示例#10
0
def GetDependencies():
    """
    Returns information about the dependencies required by this repository.

    The return value should be an OrderedDict if the repository supports multiple configurations
    (aka is configurable) or a single Configuration if not.
    """

    return Configuration(
        "Boost repository common to specific versions of boost",
        [
            Dependency(
                "0EAA1DCF22804F90AD9F5A3B85A5D706",
                "Common_Environment",
                "python36",
                "https://github.com/davidbrownell/Common_Environemnt_v3.git",
            ),
        ],
    )
示例#11
0
def GetDependencies():
    """
    Returns information about the dependencies required by this repository.

    The return value should be an OrderedDict if the repository supports multiple configurations
    (aka is configurable) or a single Configuration if not.
    """

    if CurrentShell.CategoryName == "Windows":
        architectures = ["x64", "x86"]

        compiler_infos = [
            ("MSVC_2019", None),
            # ("Clang_8", None),
            ("Clang_10", "_ex"),
        ]

    else:
        # Cross compiling on Linux is much more difficult on Linux than it is on
        # Windows. Only support the current architecture.
        architectures = [CurrentShell.Architecture]

        compiler_infos = [
            # ("Clang_8", None),
            ("Clang_10", "_ex"),
        ]

    d = OrderedDict()

    for boost_version in ["1.70.0"]:
        d[boost_version] = Configuration(
            "boost {} (No compiler dependencies)".format(boost_version),
            [
                Dependency(
                    "407DD743110A4FB1871AEF60CBEC99A0",
                    "Common_cpp_boost_{}".format(boost_version),
                    "standard",
                    "https://github.com/davidbrownell/Common_cpp_boost_{}.git".format(boost_version),
                ),
                Dependency(
                    "398F6BEC057C4FE4B724153DF4EB8AE4",
                    "Common_cpp_Helpers",
                    "standard",
                    "https://github.com/davidbrownell/Common_cpp_Helpers.git",
                ),
            ],
        )

        for config_name, architecture_configuration_suffix in compiler_infos:
            architecture_configuration_suffix = architecture_configuration_suffix or ""

            for architecture in architectures:
                this_config_name = "{}_{}_{}{}".format(boost_version, config_name, architecture, architecture_configuration_suffix)
                this_config_desc = "boost {} - {} ({}{})".format(boost_version, config_name, architecture, architecture_configuration_suffix)

                d[this_config_name] = Configuration(
                    this_config_desc,
                    [
                        Dependency(
                            "407DD743110A4FB1871AEF60CBEC99A0",
                            "Common_cpp_boost_{}".format(boost_version),
                            "{}_{}{}".format(config_name, architecture, architecture_configuration_suffix),
                            "https://github.com/davidbrownell/Common_cpp_boost_{}.git".format(boost_version),
                        ),
                        Dependency(
                            "398F6BEC057C4FE4B724153DF4EB8AE4",
                            "Common_cpp_Helpers",
                            "standard",
                            "https://github.com/davidbrownell/Common_cpp_Helpers.git",
                        ),
                    ],
                )

    return d
    def Load(
        cls,
        repository_root,
        configuration,
        is_fast_environment,
        force=False,
    ):
        if not force and os.getenv(Constants.DE_REPO_ROOT_NAME):
            repository_root = os.getenv(Constants.DE_REPO_ROOT_NAME)
            configuration = os.getenv(Constants.DE_REPO_CONFIGURATION_NAME)

        filename = cls._GetFilename(repository_root, configuration,
                                    is_fast_environment)

        if not force and os.path.isfile(filename):
            try:
                # Load the json
                with open(filename, 'r') as f:
                    data = json.load(f)

                # Convert the json structure into concrete types
                tool_version_specs = [
                    Configuration.VersionInfo(
                        vi_data["Name"],
                        vi_data["Version"],
                    ) for vi_data in data["VersionSpecs"]["Tools"]
                ]

                library_version_specs = {
                    language: [
                        Configuration.VersionInfo(
                            vi_data["Name"],
                            vi_data["Version"],
                        ) for vi_data in language_version_infos
                    ]
                    for language, language_version_infos in six.iteritems(
                        data["VersionSpecs"]["Libraries"])
                }

                return cls(
                    data["Id"],
                    data["Root"],
                    data["IsMixinRepo"],
                    data["Configuration"],
                    [
                        Repository(
                            repo_data["Id"],
                            repo_data["Name"],
                            repo_data["Root"],
                            repo_data["Configuration"],
                            repo_data["IsMixinRepo"],
                        ) for repo_data in data["PrioritizedRepositories"]
                    ],
                    Configuration.VersionSpecs(
                        tool_version_specs,
                        library_version_specs,
                    ),
                )

            except:
                pass

        # Generate the data
        repository_root = CommonEnvironmentImports.FileSystem.Normalize(
            repository_root)
        assert os.path.isdir(repository_root), repository_root

        repositories = OrderedDict()

        tool_version_info = []
        library_version_info = {}
        version_info_lookup = {}

        # ----------------------------------------------------------------------
        def Walk(
            referencing_repo,
            repo,
            priority_modifier,
        ):
            if repo.Id not in repositories:
                bootstrap_info = EnvironmentBootstrap.Load(repo.Root)

                bootstrap_info.Repo = repo
                bootstrap_info.ReferencingRepo = referencing_repo
                bootstrap_info.priority_modifier = 0

                repositories[repo.Id] = bootstrap_info

                recurse = True
            else:
                recurse = False

            bootstrap_info = repositories[repo.Id]
            bootstrap_info.priority_modifier += priority_modifier

            # Ensure that the configuration name is valid
            if bootstrap_info.IsConfigurable and not repo.Configuration:
                raise Exception(
                    "The repository at '{}' is configurable, but no configuration was provided."
                    .format(repo.Root))

            if not bootstrap_info.IsConfigurable and repo.Configuration:
                raise Exception(
                    "The repository at '{}' is not configurable, but a configuration was provided ({})."
                    .format(repo.Root, repo.Configuration))

            if repo.Configuration not in bootstrap_info.Configurations:
                raise Exception(
                    textwrap.dedent("""\
                    The configuration '{config}' is not a valid configuration for the repository at '{root}'.
                    Valid configuration values are:
                    {configs}
                    """).format(
                        config=repo.Configuration,
                        root=repo.Root,
                        configs='\n'.join([
                            "    - {}".format(config or "<None>") for config in
                            six.iterkeys(bootstrap_info.Configurations)
                        ]),
                    ))

            # Check for consistent repo locations
            if repo.Root != bootstrap_info.Repo.Root:
                raise Exception(
                    textwrap.dedent("""\
                    There is a mismatch in repository locations.

                    Repository:                 {name} <{id}>
        
                    New Location:               {new_value}
                    Referenced By:              {new_name} <{new_id}> [{new_root}]
        
                    Original Location:          {original_value}
                    Referenced By:              {original_name} <{original_id}> [{original_root}]
                    """).format(
                        name=repo.Name,
                        id=repo.Id,
                        new_value=repo.Root,
                        new_name=referencing_repo.Name,
                        new_id=referencing_repo.Id,
                        new_root=referencing_repo.Root,
                        original_value=bootstrap_info.Repo.Root,
                        original_name=bootstrap_info.Repo.Name,
                        original_id=bootstrap_info.Repo.Id,
                        original_root=bootstrap_info.Repo.Root,
                    ))

            # Check for consistent configurations
            if repo.Configuration != bootstrap_info.Repo.Configuration:
                raise Exception(
                    textwrap.dedent("""\
                    There is a mismatch in repository configurations:
        
                    Repository:                 {name} <{id}>
        
                    New Configuration:          {new_value}
                    Referenced By:              {new_name} <{new_id}> [{new_root}]
        
                    Original Configuration:     {original_value}
                    Referenced By:              {original_name} <{original_id}> [{original_root}]
                    """).format(
                        name=repo.Name,
                        id=repo.Id,
                        new_value=repo.Configuration,
                        new_name=referencing_repo.Name,
                        new_id=referencing_repo.Id,
                        new_root=referencing_repo.Root,
                        original_value=bootstrap_info.Repo.Configuration,
                        original_name=bootstrap_info.Repo.Name,
                        original_id=bootstrap_info.Repo.Id,
                        original_root=bootstrap_info.Repo.Root,
                    ))

            # Process the version info

            # ----------------------------------------------------------------------
            def OnVersionMismatch(type_, version_info, existing_version_info):
                original_repo = version_info_lookup[existing_version_info]

                raise Exception(
                    textwrap.dedent("""\
                    There was a mismatch in version information.
        
                    Item:                       {name} <{type_}>
        
                    New Version:                {new_value}
                    Specified By:               {new_name} ({new_config}) <{new_id}> [{new_root}]
        
                    Original Version:           {original_value}
                    Specified By:               {original_name} ({original_config}) <{original_id}> [{original_root}]
                    """).format(
                        name=version_info.Name,
                        type_=type_,
                        new_value=version_info.Version,
                        new_name=repo.Name,
                        new_config=repo.Configuration,
                        new_id=repo.Id,
                        new_root=repo.Root,
                        original_value=existing_version_info.Version,
                        original_name=original_repo.Name,
                        original_config=original_repo.Configuration,
                        original_id=original_repo.Id,
                        original_root=original_repo.Root,
                    ))

            # ----------------------------------------------------------------------

            for version_info in bootstrap_info.Configurations[
                    repo.Configuration].VersionSpecs.Tools:
                existing_version_info = next(
                    (tvi for tvi in tool_version_info
                     if tvi.Name == version_info.Name), None)

                if existing_version_info is None:
                    tool_version_info.append(version_info)
                    version_info_lookup[version_info] = repo

                elif version_info.Version != existing_version_info.Version:
                    OnVersionMismatch("Tools", version_info,
                                      existing_version_info)

            for library_language, version_info_items in six.iteritems(
                    bootstrap_info.Configurations[
                        repo.Configuration].VersionSpecs.Libraries):
                for version_info in version_info_items:
                    existing_version_info = next(
                        (lvi for lvi in library_version_info.get(
                            library_language, [])
                         if lvi.Name == version_info.Name), None)

                    if existing_version_info is None:
                        library_version_info.setdefault(
                            library_language, []).append(version_info)
                        version_info_lookup[version_info] = repo

                    elif version_info.Version != existing_version_info.Version:
                        OnVersionMismatch(
                            "{} Libraries".format(library_language),
                            version_info, existing_version_info)

            # Process this repository's dependencies
            if recurse:
                for dependency_info in bootstrap_info.Configurations[
                        repo.Configuration].Dependencies:
                    Walk(
                        repo,
                        Repository.Create(dependency_info.RepositoryRoot,
                                          dependency_info.Configuration),
                        priority_modifier + 1,
                    )

        # ----------------------------------------------------------------------

        this_repository = Repository.Create(repository_root, configuration)

        Walk(None, this_repository, 1)

        # Order the results from the most- to least-frequently requested
        priority_values = [(id, info.priority_modifier)
                           for id, info in six.iteritems(repositories)]
        priority_values.sort(key=lambda x: x[1], reverse=True)

        this_bootstrap_info = repositories[priority_values[-1][0]]
        this_configuration = this_bootstrap_info.Configurations[configuration]

        # Check the fingerprints
        calculated_fingerprint = Utilities.CalculateFingerprint(
            [
                repository_root,
            ] + [
                dependency.RepositoryRoot
                for dependency in this_configuration.Dependencies
            ],
            repository_root,
        )
        if this_configuration.Fingerprint != calculated_fingerprint:
            lines = []

            line_template = "{0:<80}  :  {1}"

            for k, v in six.iteritems(calculated_fingerprint):
                if k not in this_configuration.Fingerprint:
                    lines.append(line_template.format(k[0], "Added"))
                else:
                    lines.append(
                        line_template.format(
                            k, "Identical"
                            if v == this_configuration.Fingerprint[k] else
                            "Modified"))

            for k in six.iteritems(this_configuration.Fingerprint):
                if k not in calculated_fingerprint:
                    lines.append(line_template.format(k[0], "Removed"))

            assert lines
            raise Exception(
                textwrap.dedent("""\
                ********************************************************************************
                ********************************************************************************
                It appears that one or more of the repositories that this repository depends on
                have changed.

                Please run '{setup}' again.
        
                    {status}
        
                ********************************************************************************
                ********************************************************************************
                """).format(
                    setup=CommonEnvironmentImports.CurrentShell.
                    CreateScriptName(Constants.SETUP_ENVIRONMENT_NAME),
                    status=CommonEnvironmentImports.StringHelpers.LeftJustify(
                        '\n'.join(lines), 4),
                ))

        # Create the object
        return cls(
            this_repository.Id,
            repository_root,
            this_bootstrap_info.IsMixinRepo,
            configuration,
            is_fast_environment,
            [repositories[id].Repo for id, _ in priority_values],
            Configuration.VersionSpecs(tool_version_info,
                                       library_version_info),
        )
示例#13
0
    def Execute():
        commands = []

        # Load the activation data
        output_stream.write("\nLoading data...")
        with output_stream.DoneManager(suffix='\n', ):
            is_activated = bool(os.getenv(Constants.DE_REPO_ACTIVATED_FLAG))

            activation_data = ActivationData.Load(
                repository_root,
                configuration,
                fast,
                force=force or not is_activated,
            )

        # Augment the version specs with those provided on the command line
        for k, v in six.iteritems(version_specs):
            keys = k.split('/')

            if keys[0] == Constants.TOOLS_SUBDIR:
                if len(keys) != 2:
                    raise Exception(
                        "'{}' is not a valid version spec; expected '{}/<Tool Name>'."
                        .format(k, Constants.TOOLS_SUBDIR))

                name = keys[1]
                version_infos = activation_data.VersionSpecs.Tools

            elif keys[0] == Constants.LIBRARIES_SUBDIR:
                if len(keys) != 3:
                    raise Exception(
                        "'{}' is not a valid version spec; expected '{}/<Language>/<Library Name>'."
                        .format(k, Constants.LIBRARIES_SUBDIR))

                name = keys[2]
                version_infos = activation_data.VersionSpecs.Libraries.setdefault(
                    keys[1], [])

            else:
                raise Exception(
                    "'{}' is not a valid version spec prefix".format(keys[0]))

            found = False
            for version_info in version_infos:
                if version_info.Name == name:
                    version_info.Version = v
                    found = True
                    break

            if not found:
                version_infos.append(Configuration.VersionInfo(name, v))

        # ----------------------------------------------------------------------
        def LoadMixinLibrary(mixin_path):
            mixin_activation_data = ActivationData.Load(
                mixin_path,
                configuration=None,
                force=True,
            )
            if not mixin_activation_data.IsMixinRepo:
                raise Exception(
                    "The repository at '{}' is not a mixin repository".format(
                        mixin_path))

            assert not mixin_activation_data.VersionSpecs.Tool
            assert not mixin_activation_data.VersionSpecs.Libraries
            assert len(mixin_activation_data.PrioritizedRepositories) == 1

            mixin_repo = mixin_activation_data.PrioritizedRepositories[0]
            mixin_repo.IsMixinRepo = True

            # Add this repo as a repo to be activated if it isn't already in the list
            if not any(r.Id == mixin_repo.Id
                       for r in activation_data.PrioritizedRepositories):
                activation_data.PrioritizedRepositories.append(mixin_repo)

        # ----------------------------------------------------------------------

        # Are we activating a mixin repository?
        is_mixin_repo = EnvironmentBootstrap.Load(repository_root).IsMixinRepo

        if is_mixin_repo:
            if force:
                raise Exception(
                    "'force' cannot be used with mixin repositories")

            LoadMixinLibrary(repository_root)

        for mixin in mixins:
            LoadMixinLibrary(mixin)

        # Ensure that the generated dir exists
        generated_dir = activation_data.GetActivationDir()
        CommonEnvironmentImports.FileSystem.MakeDirs(generated_dir)

        methods = [
            _ActivateActivationData,
            _ActivateNames,
            _ActivateTools,
            _ActivatePython,
            _ActivateScripts,
            _ActivateCustom,
            _ActivatePrompt,
        ]

        if not is_mixin_repo:
            methods = [
                _ActivateOriginalEnvironment,
                _ActivateRepoEnvironmentVars,
            ] + methods

        args = OrderedDict([
            ("output_stream", output_stream),
            ("configuration", configuration),
            ("activation_data", activation_data),
            ("version_specs", activation_data.VersionSpecs),
            ("generated_dir", generated_dir),
            ("debug", debug),
            ("verbose", verbose),
            ("no_python_libraries", no_python_libraries),
            ("fast", fast),
            ("repositories", activation_data.PrioritizedRepositories),
            ("is_mixin_repo", is_mixin_repo),
        ])

        # Invoke the methods
        for original_method in methods:
            method = CommonEnvironmentImports.Interface.CreateCulledCallable(
                original_method)

            result = method(args)

            if isinstance(result, list):
                commands += result
            elif result is not None:
                commands.append(result)

        return commands
示例#14
0
def GetDependencies():
    """
    Returns information about the dependencies required by this repository.

    The return value should be an OrderedDict if the repository supports multiple configurations
    (aka is configurable) or a single Configuration if not.
    """

    d = OrderedDict()

    architectures = ["x64"]

    if CurrentShell.CategoryName == "Windows":
        architectures.append("x86")

    # Clang
    for version, guid in [("8", "3DE9F3430E494A6C8429B26A1503C895")]:
        for architecture in architectures:
            d["{}_Clang_{}".format(architecture, version)] = Configuration(
                "Builds using Clang {} for a {} architecture".format(
                    version,
                    architecture,
                ),
                [
                    Dependency(
                        guid,
                        "Common_cpp_Clang_{}".format(version),
                        "{}-ex".format(architecture),
                        "https://github.com/davidbrownell/Common_cpp_Clang_{}".format(
                            version,
                        ),
                    ),
                ],
            )

    # MSVC
    if CurrentShell.CategoryName == "Windows":
        for version, guid in [
            ("2019", "AB7D87C49C2449F79D9F42E5195030FD"),
            ("2017", "8FC8ACE80A594D2EA996CAC5DBFFEBBC"),
        ]:
            for architecture in architectures:
                d["{}_MSVC_{}".format(architecture, version)] = Configuration(
                    "Builds using MSVC {} for a {} architecture".format(
                        version,
                        architecture,
                    ),
                    [
                        Dependency(
                            guid,
                            "Common_cpp_MSVC_{}".format(version),
                            architecture,
                            "https://github.com/davidbrownell/Common_cpp_MSVC_{}.git".format(
                                version,
                            ),
                        ),
                    ],
                )

    # Misc
    d["system_compiler"] = Configuration(
        "Enables basic C++ tools (cmake, ninja, doxygen, etc.)",
        [
            Dependency(
                "F33C43DA6BB54336A7573B39509CDAD7",
                "Common_cpp_Common",
                "x64",
                "https://github.com/davidbrownell/Common_cpp_Common.git",
            ),
        ],
    )

    if CurrentShell.CategoryName == "Linux":
        d["universal_linux"] = Configuration(
            "Builds using the Holy Build Box Docker Image (phusion/holy-build-box-64). More info at http://phusion.github.io/holy-build-box/",
            [
                Dependency(
                    "F33C43DA6BB54336A7573B39509CDAD7",
                    "Common_cpp_Common",
                    "x64",
                    "https://github.com/davidbrownell/Common_cpp_Common.git",
                ),
            ],
        )

    # Set the defaults
    d["x64_Clang"] = d["x64_Clang_8"]
    if "x86" in architectures:
        d["x86_Clang"] = d["x86_Clang_8"]

    if CurrentShell.CategoryName == "Windows":
        d["x64_MSVC"] = d["x64_MSVC_2019"]
        d["x86_MSVC"] = d["x86_MSVC_2019"]

    d["x64"] = d["x64_Clang"]
    if "x86" in architectures:
        d["x86"] = d["x86_Clang"]

    return d
def GetDependencies():
    """
    Returns information about the dependencies required by this repository.

    The return value should be an OrderedDict if the repository supports multiple configurations
    (aka is configurable) or a single Configuration if not.
    """

    d = OrderedDict()

    if CurrentShell.CategoryName == "Windows":
        architectures = ["x64", "x86"]

        # On Windows, clang requires MSVC
        additional_dependency_factories = [
            lambda arch: Dependency(
                "AB7D87C49C2449F79D9F42E5195030FD", "Common_cpp_MSVC_2019",
                arch,
                "https://github.com/davidbrownell/Common_cpp_MSVC_2019.git")
        ]
        native_linker_desc = "Augmented with MSVC"

    else:
        # Cross compiling on Linux is much more difficult on Linux than it is on
        # Windows. Only support the current architecture.
        architectures = [CurrentShell.Architecture]

        # Eventually, this code should depend on a custom build of GCC. However, this isn't
        # working as expected right now.
        #
        # On Linux, the following libraries must be installed:
        #   - libstdc++-7-dev
        #
        # additional_dependency_factories = [lambda arch: Dependency("A21B8960BF0347628EBCE72261DAFEA7", "Common_cpp_GCC", None, "https://github.com/davidbrownell/Common_cpp_GCC.git")]
        additional_dependency_factories = []

        native_linker_desc = "Augmented with GCC"

    for key_suffix, desc_suffix, dependency_factories in [
        (None, None, []),
        ("ex", native_linker_desc, additional_dependency_factories),
    ]:
        for architecture in architectures:
            if key_suffix is None:
                key = architecture
                desc = architecture
            else:
                key = "{}_{}".format(architecture, key_suffix)
                desc = "{} <{}>".format(architecture, desc_suffix)

            d[key] = Configuration(
                desc,
                [
                    Dependency(
                        "F33C43DA6BB54336A7573B39509CDAD7",
                        "Common_cpp_Common", architecture,
                        "https://github.com/davidbrownell/Common_cpp_Common.git"
                    )
                ] + [
                    dependency_factory(architecture)
                    for dependency_factory in dependency_factories
                ],
            )

    d["noop"] = Configuration(
        "Configuration that doesn't do anything; in Bootstrap repositories (where different versions of repositories conflict with each other (normally, the use of these repositories are mutually exclusive))",
        [
            Dependency(
                "0EAA1DCF22804F90AD9F5A3B85A5D706", "Common_Environment",
                "python36",
                "https://github.com/davidbrownell/Common_Environment_v3.git")
        ],
    )

    return d
示例#16
0
def GetDependencies():
    """
    Returns information about the dependencies required by this repository.

    The return value should be an OrderedDict if the repository supports multiple configurations
    (aka is configurable) or a single Configuration if not.
    """

    d = OrderedDict()

    d["standard"] = Configuration(
        "Standard configuration without a compiler dependency",
        [
            Dependency(
                "0EAA1DCF22804F90AD9F5A3B85A5D706",
                "Common_Environment",
                "python36",
                "https://github.com/davidbrownell/Common_Environment-v3.git",
            ),
        ],
    )

    repo_depedencies = []

    if CurrentShell.CategoryName == "Windows":
        repo_depedencies += [
            (
                "MSVC_2019",
                "Common_cpp_MSVC_2019",
                "AB7D87C49C2449F79D9F42E5195030FD",
                None,
            ),
            (
                "MSVC_2017",
                "Common_cpp_MSVC_2017",
                "8FC8ACE80A594D2EA996CAC5DBFFEBBC",
                None,
            ),
        ]

        architectures = ["x64", "x86"]
    else:
        architectures = [CurrentShell.Architecture]

    repo_depedencies += [
        (
            "Clang_10",
            "Common_cpp_Clang_10",
            "42DE100A1DAE4FFC9697F75566C63DEB",
            "_ex",
        ),
        (
            "Clang_8",
            "Common_cpp_Clang_8",
            "3DE9F3430E494A6C8429B26A1503C895",
            "_ex",
        ),
    ]

    for short_name, repo_name, repo_id, config_suffix in repo_depedencies:
        for architecture in architectures:
            d["{}_{}".format(short_name, architecture)] = Configuration(
                "{} - {}".format(short_name, architecture),
                [
                    Dependency(
                        repo_id,
                        repo_name,
                        "{}{}".format(architecture, config_suffix or ""),
                        "https://github.com/davidbrownell/{}.git".format(
                            repo_name),
                    ),
                ],
            )

    return d
示例#17
0
def GetDependencies():
    """
    Returns information about the dependencies required by this repository.

    The return value should be an OrderedDict if the repository supports multiple configurations
    (aka is configurable) or a single Configuration if not.
    """

    raise Exception(
        "Remove this exception once you have updated the configuration for your new repository (GetDependencies)."
    )

    # To support multiple configurations...
    return OrderedDict([
        (
            "Config1",
            Configuration(
                "A description of Config1; this configuration uses python36",
                [
                    Dependency(
                        "0EAA1DCF22804F90AD9F5A3B85A5D706",  # Id for Common_Environment; found in <Common_Environment>/__RepositoryId__
                        "Common_Environment",  # Name used if Common_Environment cannot be found during setup
                        "python36",  # Configuration value used when activating Common_Environment
                    ),
                    # Other dependencies go here (if any)
                ],
                # By default, the most recent version of all tools and libraries will be activated for this repository and its dependencies.
                # If necessary, you can override this behavior by specifying specific versions for tools that should be used when activating
                # this repository with this configuration.
                VersionSpecs(  # Tools
                    [
                        VersionInfo("Some Tool", "v0.0.1"),
                    ],
                    # Libraries, organized by language
                    {
                        "Python": [
                            VersionInfo("Some Library", "v1.2.3"),
                        ],
                    },
                ),
            )),
        (
            "Config2",
            Configuration(
                "A descrption of Config2; this configuration uses python27",
                [
                    Dependency(
                        "0EAA1DCF22804F90AD9F5A3B85A5D706",  # Id for Common_Environment; found in <Common_Environment>/__RepositoryId__
                        "Common_Environment",  # Name used if Common_Environment cannot be found during setup
                        "python27",  # Configuration value used when activating Common_Environment
                    ),
                    # Other dependencies go here (if any)
                ],
                # By default, the most recent version of all tools and libraries will be activated for this repository and its dependencies.
                # If necessary, you can override this behavior by specifying specific versions for tools that should be used when activating
                # this repository with this configuration.
                VersionSpecs(  # Tools
                    [
                        VersionInfo("Some Other Tool", "v0.2.1"),
                    ],
                    # Libraries, organized by language
                    {
                        "C++": [
                            VersionInfo("Some Library", "v1.2.3"),
                        ],
                    },
                ),
            )),
    ])

    # To support a single (unnamed) configuration...
    return Configuration(
        "A description of Config1; this configuration uses python36",
        [
            Dependency(
                "0EAA1DCF22804F90AD9F5A3B85A5D706",  # Id for Common_Environment; found in <Common_Environment>/__RepositoryId__
                "Common_Environment",  # Name used if Common_Environment cannot be found during setup
                "python36",  # Configuration value used when activating Common_Environment
            ),
            # Other dependencies go here (if any)
        ],
        # By default, the most recent version of all tools and libraries will be activated for this repository and its dependencies.
        # If necessary, you can override this behavior by specifying specific versions for tools that should be used when activating
        # this repository with this configuration.
        VersionSpecs(  # Tools
            [
                VersionInfo("Some Tool", "v0.0.1"),
            ],
            # Libraries, organized by language
            {
                "Python": [
                    VersionInfo("Some Library", "v1.2.3"),
                ],
            },
        ),
    )