def named_builds(self, confs): self._builds = [] self._named_builds = {} for key, pages in confs.items(): for values in pages: if len(values) == 2: self._named_builds.setdefault(key,[]).append(BuildConf(values[0], values[1], {}, {})) elif len(values) != 4: raise Exception("Invalid build configuration, has to be a tuple of " "(settings, options, env_vars, build_requires)") else: self._named_builds.setdefault(key,[]).append(BuildConf(*values))
def builds(self, confs): """For retrocompatibility directly assigning builds""" self._named_builds = {} self._builds = [] for values in confs: if len(values) == 2: self._builds.append(BuildConf(values[0], values[1], {}, {})) elif len(values) != 4: raise Exception("Invalid build configuration, has to be a tuple of " "(settings, options, env_vars, build_requires)") else: self._builds.append(BuildConf(*values))
def add(self, settings=None, options=None, env_vars=None, build_requires=None, reference=None): settings = settings or {} options = options or {} env_vars = env_vars or {} build_requires = build_requires or {} if reference: reference = ConanFileReference.loads("%s@%s/%s" % (reference, self.username, self.channel)) reference = reference or self.reference self._builds.append(BuildConf(settings, options, env_vars, build_requires, reference))
def test_assign_builds_retrocompatibility(self): self.packager = ConanMultiPackager("--build missing -r conan.io", "lasote", "mychannel", runner=self.runner, gcc_versions=["4.3", "5"], use_docker=True) self.packager.add_common_builds() self.packager.builds = [({"os": "Windows"}, {"option": "value"})] self.assertEquals(self.packager.items, [BuildConf(settings={'os': 'Windows'}, options={'option': 'value'}, env_vars={}, build_requires={}, reference=None)])
def add(self, settings=None, options=None, env_vars=None, build_requires=None): settings = settings or {} options = options or {} env_vars = env_vars or {} build_requires = build_requires or {} self.builds.append(BuildConf(settings, options, env_vars, build_requires))
"""This script build Conan.io package to multiple platforms.""" import platform from copy import copy from conan.packager import ConanMultiPackager from conan.builds_generator import BuildConf if __name__ == "__main__": builder = ConanMultiPackager() builder.add_common_builds(shared_option_name="libpcap:shared", pure_c=True) for settings, options, env_vars, build_requires in reversed( builder.builds): if platform.system() == "Linux": false_options = copy(options) false_options["libpcap:enable_usb"] = True false_options["libpcap:enable_bluetooth"] = True false_options["libpcap:enable_dbus"] = True false_options["libpcap:enable_packet_ring"] = True builder.builds.append( BuildConf(settings, false_options, env_vars, build_requires)) builder.run()