本文整理汇总了Python中qitoolchain.get_toolchain函数的典型用法代码示例。如果您正苦于以下问题:Python get_toolchain函数的具体用法?Python get_toolchain怎么用?Python get_toolchain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_toolchain函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_toolchain
def get_toolchain(args):
"""
Get the toolchain to use.
If we are inside a build worktree, return the default toolchain is this worktree.
"""
if args.toolchain_name:
return qitoolchain.get_toolchain(args.toolchain_name)
config = args.config
if not config:
try:
build_worktree = qibuild.parsers.get_build_worktree(args)
active_build_config = build_worktree.build_config.active_build_config
if active_build_config:
config = active_build_config.toolchain
else:
config = None
except qisys.worktree.NotInWorkTree:
config = None
if not config:
mess = "Could not find which config to use.\n"
mess += "(not in a work tree or no default config in "
mess += "current worktree configuration)\n"
mess += "Please specify a configuration with -c, --config \n"
mess += "or a toolchain name with -t, --toolchain"
raise Exception(mess)
qibuild_cfg = qibuild.config.QiBuildConfig()
qibuild_cfg.read()
build_config = qibuild_cfg.configs.get(config)
if not build_config:
raise Exception("No such config: %s" % config)
tc_name = build_config.toolchain
if not tc_name:
raise Exception("config %s has no toolchain" % config)
return qitoolchain.get_toolchain(tc_name)
开发者ID:aldebaran,项目名称:qibuild,代码行数:34,代码来源:parsers.py
示例2: do
def do(args):
"""Main entry point"""
worktree = args.worktree
if not worktree:
worktree = os.getcwd()
if args.config:
# Just make sure the user choose a valid default toolchain
qitoolchain.get_toolchain(args.config)
worktree = qibuild.sh.to_native_path(worktree)
parent_worktree = qisrc.worktree.guess_worktree(worktree)
if parent_worktree:
if parent_worktree != worktree:
# Refuse to create nested worktrees
ui.error("""A qi worktree already exists in {parent_worktree}
Refusing to create a nested worktree in {worktree}
Use:
qibuild init -f -w {parent_worktree}
If you want to re-initialize the worktree in {parent_worktree}
""".format(worktree=worktree, parent_worktree=parent_worktree))
sys.exit(1)
else:
# Refuse to re-initalize the worktree unless "-f" is given
if not args.force:
ui.warning("There is already a worktree in", worktree, "\n"
"Use --force if you want to re-initialize this worktree")
return
qibuild.toc.create(worktree, force=args.force)
# User maybe re-running qibuild init because it has a
# bad default exception ...
try:
toc = qibuild.toc.toc_open(worktree)
except qibuild.toc.WrongDefaultException:
pass
toc_cfg_path = os.path.join(worktree, ".qi", "qibuild.xml")
qibuild_cfg = qibuild.config.QiBuildConfig()
qibuild_cfg.read()
qibuild_cfg.read_local_config(toc_cfg_path)
qibuild_cfg.local.defaults.config = args.config
qibuild_cfg.write_local_config(toc_cfg_path)
# Safe to be called now that we've created it
# and that we know we don't have a wrong defaut config:
toc = qibuild.toc.toc_open(worktree)
if not args.interactive:
return
qibuild.wizard.run_config_wizard(toc)
开发者ID:sanyaade-research-hub,项目名称:qibuild,代码行数:53,代码来源:init.py
示例3: do
def do(args):
""" Main entry point
"""
dry_run = args.dry_run
tc = qitoolchain.get_toolchain(args.name)
tc.clean_cache(dry_run=dry_run)
开发者ID:Giessen,项目名称:qibuild,代码行数:7,代码来源:clean_cache.py
示例4: get_toolchain_binary_paths
def get_toolchain_binary_paths(build_config):
""" Get the toolchain of the build_config and return the PATH of every bin packages as a string """
bins = []
if build_config:
toolchain = None
try:
if hasattr(build_config, 'toolchain'):
toolchain = build_config.toolchain
else:
# When called from qibuildfarm.release.functions (ie: build_config is the build_config name as string)
from qibuild.config import QiBuildConfig
from qitoolchain import get_toolchain
qibuild_cfg = QiBuildConfig()
qibuild_cfg.read()
qibuild_config = qibuild_cfg.configs.get(build_config)
if qibuild_config:
toolchain = get_toolchain(qibuild_config.toolchain)
if toolchain:
for pkg in toolchain.packages:
bin_dir = os.path.join(pkg.path, 'bin')
if os.path.isdir(bin_dir):
bins.append(bin_dir)
except Exception:
pass
return os.pathsep.join(bins)
开发者ID:aldebaran,项目名称:qibuild,代码行数:25,代码来源:command.py
示例5: do
def do(args):
""" Main entry point """
force_rm = args.force_remove
tc = qitoolchain.get_toolchain(args.name)
ui.info(ui.green, "Removing toolchain", ui.blue, tc.name)
tc.remove(force_remove=force_rm)
ui.info(ui.green, "done")
开发者ID:Giessen,项目名称:qibuild,代码行数:7,代码来源:remove.py
示例6: do
def do(args):
"""Main entry point
"""
feed = args.feed
tc_name = args.name
if tc_name:
toolchain = qitoolchain.get_toolchain(tc_name)
if not feed:
feed = toolchain.feed_url
if not feed:
mess = "Could not find feed for toolchain %s\n" % tc_name
mess += "Please check configuration or " \
"specifiy a feed on the command line\n"
raise Exception(mess)
toolchain.update(feed)
else:
tc_names = qitoolchain.get_tc_names()
for i, tc_name in enumerate(tc_names, start=1):
toolchain = qitoolchain.toolchain.Toolchain(tc_name)
tc_feed = toolchain.feed_url
if not tc_feed:
ui.warning("No feed found for %s, skipping" % tc_name)
continue
ui.info(ui.green, "*", ui.reset, "(%i/%i)" % (i, len(tc_names)),
ui.green, "Updating", ui.blue, tc_name)
toolchain.update(tc_feed)
开发者ID:Mhalla,项目名称:qibuild,代码行数:27,代码来源:update.py
示例7: do
def do(args):
"""Main entry point
"""
feed = args.feed
tc_name = args.name
dry_run = args.dry_run
if tc_name:
toolchain = qitoolchain.get_toolchain(tc_name)
if not feed:
feed = qitoolchain.toolchain.get_tc_feed(tc_name)
if not feed:
mess = "Could not find feed for toolchain %s\n" % tc_name
mess += "Pleas check configuration or specifiy a feed on the command line\n"
raise Exception(mess)
ui.info(ui.green, "Updating toolchain", tc_name, "with", feed)
toolchain.parse_feed(feed, dry_run=dry_run)
else:
tc_names = qitoolchain.get_tc_names()
i = 0
for tc_name in tc_names:
i += 1
tc_feed = qitoolchain.toolchain.get_tc_feed(tc_name)
ui.info(ui.green, "*", ui.reset, "(%i/%i)" % (i, len(tc_names)),
ui.green, "Updating", ui.blue, tc_name)
if not tc_feed:
ui.warning("No feed found for %s, skipping" % tc_name)
continue
ui.info(ui.green, "Reading", tc_feed)
toolchain = qitoolchain.Toolchain(tc_name)
toolchain.parse_feed(tc_feed, dry_run=dry_run)
开发者ID:sanyaade-research-hub,项目名称:qibuild,代码行数:31,代码来源:update.py
示例8: do
def do(args):
""" Main entry point """
toolchain = qitoolchain.get_toolchain(args.name)
svn_packages = list()
for package in toolchain.packages:
svn_dir = os.path.join(package.path, ".svn")
if os.path.exists(svn_dir):
svn_packages.append(package)
not_clean = list()
for i, svn_package in enumerate(svn_packages, start=1):
to_write = "Checking (%d/%d) " % (i, len(svn_packages))
sys.stdout.write(to_write + "\r")
sys.stdout.flush()
svn = qisrc.svn.Svn(svn_package.path)
_rc, out = svn.call("status", raises=False)
if out:
not_clean.append((svn_package.name, out))
if not not_clean:
ui.info("\n", ui.green, "All OK")
sys.exit(0)
ui.warning("Some svn packages are not clean")
for name, message in not_clean:
ui.info(ui.green, "*", ui.reset, ui.blue, name)
ui.info(message)
sys.exit(1)
开发者ID:aldebaran,项目名称:qibuild,代码行数:25,代码来源:svn_status.py
示例9: do
def do(args):
""" Main entry point """
feed = args.feed
tc_name = args.name
if tc_name:
toolchain = qitoolchain.get_toolchain(tc_name)
if not feed:
feed = toolchain.feed_url
if not feed:
mess = "Could not find feed for toolchain %s\n" % tc_name
mess += "Please check configuration or " \
"specifiy a feed on the command line\n"
raise Exception(mess)
toolchain.update(feed, branch=args.branch, name=args.feed_name)
else:
tc_names = qitoolchain.get_tc_names()
tc_with_feed = [x for x in tc_names if qitoolchain.toolchain.Toolchain(x).feed_url]
tc_without_feed = list(set(tc_names) - set(tc_with_feed))
for i, tc_name in enumerate(tc_with_feed, start=1):
toolchain = qitoolchain.toolchain.Toolchain(tc_name)
tc_feed = toolchain.feed_url
ui.info(ui.green, "*", ui.reset, "(%i/%i)" % (i, len(tc_with_feed)),
ui.green, "Updating", ui.blue, tc_name, ui.reset, "with", ui.green,
tc_feed)
toolchain.update(tc_feed)
if tc_without_feed:
ui.info("These toolchains will be skipped because they have no feed:", ", ".join(tc_without_feed))
开发者ID:aldebaran,项目名称:qibuild,代码行数:27,代码来源:update.py
示例10: add_package
def add_package(self, name, package_name, package_version="r1"):
toolchain = qitoolchain.get_toolchain(name)
package_path = self.tmp.mkdir(package_name)
package = qitoolchain.qipackage.QiPackage(package_name, package_version)
package.path = package_path.strpath
toolchain.add_package(package)
return package
开发者ID:cameronyoyos,项目名称:qibuild,代码行数:7,代码来源:conftest.py
示例11: test_simple
def test_simple(qitoolchain_action):
qitoolchain_action("create", "foo")
word_package = qitoolchain_action.get_test_package("world")
qitoolchain_action("add-package", "-c", "foo", word_package)
tc = qitoolchain.get_toolchain("foo")
world_package = tc.packages[0]
assert world_package.name == "world"
assert world_package.path
开发者ID:cameronyoyos,项目名称:qibuild,代码行数:8,代码来源:test_qitoolchain_add_package.py
示例12: toolchain
def toolchain(self):
""" The current toolchain, either set by the user from the command
line or read from the local qibuild settings
"""
if self.active_config:
return qitoolchain.get_toolchain(self.active_config)
return None
开发者ID:cgestes,项目名称:qibuild,代码行数:8,代码来源:build_config.py
示例13: do
def do(args):
""" Main method """
if args.name:
tc_names = [args.name]
else:
tc_names = qitoolchain.get_tc_names()
for tc_name in tc_names:
toolchain = qitoolchain.get_toolchain(tc_name)
ui.info(str(toolchain))
开发者ID:aldebaran,项目名称:qibuild,代码行数:9,代码来源:info.py
示例14: do
def do(args):
""" Main entry point """
tc = qitoolchain.get_toolchain(args.name)
if args.force:
ui.info(ui.green, "Removing toolchain", ui.blue, tc.name)
tc.remove()
ui.info(ui.green, "done")
else:
ui.info("Would remove toolchain", ui.blue, tc.name)
开发者ID:cameronyoyos,项目名称:qibuild,代码行数:9,代码来源:remove.py
示例15: test_simple
def test_simple(qitoolchain_action):
""" Test Simple """
qitoolchain_action("create", "foo")
qibuild.config.add_build_config("foo", toolchain="foo")
word_package = qitoolchain_action.get_test_package("world")
qitoolchain_action("add-package", "-c", "foo", word_package)
tc = qitoolchain.get_toolchain("foo")
world_package = tc.packages[0]
assert world_package.name == "world"
assert world_package.path
开发者ID:aldebaran,项目名称:qibuild,代码行数:10,代码来源:test_qitoolchain_add_package.py
示例16: do
def do(args):
""" Remove a project from a toolchain
- Check that there is a current toolchain
- Remove the package from the toolchain
"""
package_name = args.package_name
tc = qitoolchain.get_toolchain(args)
LOGGER.info("Removing package %s from toolchain %s", package_name, tc.name)
tc.remove_package(package_name)
开发者ID:sanyaade-robotic,项目名称:qibuild,代码行数:12,代码来源:remove_package.py
示例17: test_legacy_happy_path
def test_legacy_happy_path(tmpdir, qitoolchain_action):
qitoolchain_action("create", "foo")
qibuild.config.add_build_config("foo", toolchain="foo")
world = tmpdir.mkdir("world")
world.ensure("include", "world.h", file=True)
world.ensure("lib", "libworld.so", file=True)
archive = qisys.archive.compress(world.strpath)
qitoolchain_action("add-package", "-c", "foo", "--name", "world", archive)
tc = qitoolchain.get_toolchain("foo")
world_package = tc.get_package("world")
assert os.path.exists(os.path.join(world_package.path, "include", "world.h"))
assert os.path.exists(os.path.join(world_package.path, "lib", "libworld.so"))
开发者ID:Grimy,项目名称:qibuild,代码行数:12,代码来源:test_qitoolchain_add_package.py
示例18: do
def do(args):
""" Main method """
tc_names = qitoolchain.get_tc_names()
tc_name = args.name
if tc_name:
toolchain = qitoolchain.get_toolchain(tc_name)
print toolchain
else:
for tc_name in tc_names:
toolchain = qitoolchain.Toolchain(tc_name)
print toolchain
print
开发者ID:gnatali,项目名称:qibuild,代码行数:12,代码来源:info.py
示例19: read_local_settings
def read_local_settings(self):
""" Read ``<worktree>/.qi/qibuild.xml`` """
local_settings = qibuild.config.LocalSettings()
tree = qisys.qixml.read(self.build_worktree.qibuild_xml)
local_settings.parse(tree)
default_config = local_settings.defaults.config
if not default_config:
return
try:
qitoolchain.get_toolchain(default_config)
except Exception:
mess = """ \
Incorrect config detected for worktree in {build_worktree.root}
Default config set in .qi/qibuild.xml is {default_config}
but this does not match any toolchain name
"""
mess = mess.format(build_worktree=self.build_worktree,
default_config=default_config)
raise Exception(mess)
self._default_config = default_config
self.qibuild_cfg.set_active_config(default_config)
self.set_active_config(default_config)
开发者ID:cgestes,项目名称:qibuild,代码行数:22,代码来源:build_config.py
示例20: test_simple
def test_simple(qitoolchain_action, tmpdir, toolchains):
this_dir = os.path.dirname(__file__)
json_c_bz2_path_src = os.path.join(this_dir, "packages", "json-c-0.9.tbz2")
json_c_bz2_path = tmpdir.join("json-c-0.9.tbz2").strpath
qisys.sh.install(json_c_bz2_path_src, json_c_bz2_path)
res = qitoolchain_action("convert-package",
"--name", "json-c",
"--batch", json_c_bz2_path)
qitoolchain_action("create", "test")
qitoolchain_action("add-package", "--config", "test", res)
toolchain = qitoolchain.get_toolchain("test")
assert toolchain.get_package("json-c")
开发者ID:cameronyoyos,项目名称:qibuild,代码行数:13,代码来源:test_qitoolchain_convert_package.py
注:本文中的qitoolchain.get_toolchain函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论