本文整理汇总了Python中qitoolchain.get_toolchain函数的典型用法代码示例。如果您正苦于以下问题:Python get_toolchain函数的具体用法?Python get_toolchain怎么用?Python get_toolchain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_toolchain函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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)
示例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)
示例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)
示例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")
示例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)
示例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)
示例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)
示例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))
示例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
示例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
示例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
示例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))
示例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)
示例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