本文整理汇总了Python中qisys.ui.warning函数的典型用法代码示例。如果您正苦于以下问题:Python warning函数的具体用法?Python warning怎么用?Python warning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了warning函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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()
for i, tc_name in enumerate(tc_names, start=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:Giessen,项目名称:qibuild,代码行数:28,代码来源:update.py
示例2: do
def do(args):
"""Main entry point
"""
if "--name" in sys.argv:
ui.warning("--name is deprecated, use --feed-name instead")
feed = args.feed
# Normalize feed path:
if feed and os.path.exists(feed):
feed = qisys.sh.to_native_path(feed)
tc_name = args.name
# Validate the name: must be a valid filename:
bad_chars = r'<>:"/\|?*'
for bad_char in bad_chars:
if bad_char in tc_name:
mess = "Invalid toolchain name: '%s'\n" % tc_name
mess += "A valid toolchain name should not contain any "
mess += "of the following chars:\n"
mess += " ".join(bad_chars)
raise Exception(mess)
build_worktree = None
if tc_name in qitoolchain.get_tc_names():
toolchain = qitoolchain.Toolchain(tc_name)
ui.info(tc_name, "already exists,",
"updating without removing")
toolchain = qitoolchain.Toolchain(tc_name)
if feed:
toolchain.update(feed, branch=args.branch, name=args.feed_name)
return toolchain
开发者ID:Phlogistique,项目名称:qibuild,代码行数:34,代码来源:create.py
示例3: do
def do(args):
"""Main entry point"""
if args.nightly:
ui.warning("--slow option has no effect\n",
"Use `qibuild configure -DQI_WITH_NIGHTLY_TESTS=ON` instead")
if args.nightmare:
os.environ["GTEST_REPEAT"] = "20"
os.environ["GTEST_SHUFFLE"] = "yes"
if args.list:
build_worktree = qibuild.parsers.get_build_worktree(args)
project = qibuild.parsers.get_one_build_project(build_worktree, args)
json = os.path.join(project.build_directory, "qitest.json")
qisys.script.run_action("qitest.actions.list", [json])
return
cmake_builder = qibuild.parsers.get_cmake_builder(args)
deps_solver = cmake_builder.deps_solver
if args.use_deps:
dep_types = ["build"]
else:
dep_types = list()
projects = deps_solver.get_dep_projects(cmake_builder.projects,
dep_types)
res = True
for project in projects:
if args.build_first:
project.build()
res = project.run_tests(**vars(args))
if not res:
sys.exit(1)
开发者ID:Giessen,项目名称:qibuild,代码行数:32,代码来源:test.py
示例4: configure
def configure(self, **kwargs):
""" Create a correct conf.py in self.build_dir """
rel_paths = kwargs.get("rel_paths", False)
in_conf_py = os.path.join(self.source_dir, "conf.in.py")
should_use_template = False
if os.path.exists(in_conf_py):
should_use_template = True
else:
in_conf_py = os.path.join(self.source_dir, "conf.py")
if not os.path.exists(in_conf_py):
ui.error("Could not find a conf.py or a conf.in.py in", self.source_dir)
return
with open(in_conf_py) as fp:
conf = fp.read()
if should_use_template:
if self.template_project:
from_template = self.template_project.sphinx_conf
from_template = from_template.format(**kwargs)
conf = from_template + conf
else:
ui.warning("Found a conf.in.py but no template project found "
"in the worktree")
from_conf = dict()
try:
# quick hack if conf.in.py used __file__
from_conf["__file__"] = in_conf_py
exec(conf, from_conf)
conf = conf.replace("__file__", 'r"%s"' % in_conf_py)
except Exception, e:
ui.error("Could not read", in_conf_py, "\n", e)
return
开发者ID:Giessen,项目名称:qibuild,代码行数:34,代码来源:sphinx_project.py
示例5: is_submodule
def is_submodule(path):
""" Tell if the given path is a submodule
"""
if not os.path.isdir(path):
return False
# Two cases:
# * submodule not initialized -> path will be an empty dir
# * submodule initialized -> path/.git will be a file
# looking like:
# gitdir: ../../.git/modules/bar
contents = os.listdir(path)
if contents:
dot_git = os.path.join(path, ".git")
if os.path.isdir(dot_git):
return False
parent_repo_root = get_repo_root(os.path.dirname(path))
else:
parent_repo_root = get_repo_root(path)
parent_git = Git(parent_repo_root)
(retcode, out) = parent_git.submodule(raises=False)
if retcode == 0:
if not out:
return False
else:
lines = out.splitlines()
submodules = [x.split()[1] for x in lines]
rel_path = os.path.relpath(path, parent_repo_root)
return rel_path in submodules
else:
ui.warning("git submodules configuration is broken for",
parent_repo_root, "!",
"\nError was: ", ui.reset, "\n", " " + out)
return True
开发者ID:Giessen,项目名称:qibuild,代码行数:35,代码来源:git.py
示例6: parse_num_jobs
def parse_num_jobs(self, num_jobs, cmake_generator=None):
""" Convert a number of jobs to a list of cmake args. """
if not cmake_generator:
cmake_generator = \
qibuild.cmake.get_cached_var(self.build_directory, "CMAKE_GENERATOR")
if num_jobs is None:
# By default, use the "good" number just like Ninja
if "Visual Studio" in cmake_generator:
return ["/maxcpucount"]
return list()
if "Unix Makefiles" in cmake_generator or \
"Ninja" in cmake_generator:
return ["-j", str(num_jobs)]
if cmake_generator == "NMake Makefiles":
mess = "-j is not supported for %s\n" % cmake_generator
mess += "On Windows, you can use Jom or Ninja instead to compile "
mess += "with multiple processors"
raise Exception(mess)
if cmake_generator == "Xcode" or "JOM" in cmake_generator:
ui.warning("-j is ignored when used with", cmake_generator)
return list()
if "Visual Studio" in cmake_generator:
return ["/maxcpucount:%i" % num_jobs]
ui.warning("Unknown generator: %s, ignoring -j option" % cmake_generator)
return list()
开发者ID:aldebaran,项目名称:qibuild,代码行数:25,代码来源:project.py
示例7: num_jobs_to_args
def num_jobs_to_args(num_jobs, cmake_generator):
""" Convert a number of jobs to a list of cmake args
>>> num_jobs_to_args(3, "Unix Makefiles")
["-j", "3"]
>>> num_jobs_to_args(3, "NMake Makefiles"
Error: -j is not supported for NMake, use Jom
>>> num_jobs_to_args(3, "Visual Studio")
Warning: -j is ignored for Visual Studio
"""
if num_jobs == 1:
return list()
if "Unix Makefiles" in cmake_generator:
return ["-j", str(num_jobs)]
if cmake_generator == "NMake Makefiles":
mess = "-j is not supported for %s\n" % cmake_generator
mess += "On windows, you can use Jom instead to compile "
mess += "with multiple processors"
raise Exception(mess)
if "Visual Studio" in cmake_generator or \
cmake_generator == "Xcode" or \
"JOM" in cmake_generator:
ui.warning("-j is ignored when used with", cmake_generator)
return list()
ui.warning("cannot parse -j into a cmake option for generator: %s" % cmake_generator)
return list()
开发者ID:bithium,项目名称:qibuild,代码行数:30,代码来源:toc.py
示例8: do
def do(args):
test_runners = qitest.parsers.get_test_runners(args)
# rule to check for tests which doesn't follow naming convention
expr = re.compile("^test_.*")
warn_name_count = 0
warn_type_count = 0
for test_runner in test_runners:
ui.info("Tests in ", test_runner.project.sdk_directory)
for i, test in enumerate(test_runner.tests):
n = len(test_runner.tests)
name = test["name"]
name_ok = re.match(expr, name)
type_ok = (test.get("pytest") or test.get("gtest"))
if name_ok and type_ok:
ui.info_count(i, n, test["name"])
else:
message = ""
if not name_ok:
warn_name_count += 1
message += "(invalid name) "
if not type_ok:
warn_type_count += 1
message += "(no type)"
ui.info_count(i, n, name, ui.brown, message)
if warn_name_count:
msg = "%i on %i tests do not respect naming convention" % (warn_name_count, len(test_runner.tests))
ui.warning(msg)
if warn_type_count:
msg = "%i on %i tests do not have any type" % (warn_type_count, len(test_runner.tests))
ui.warning(msg)
开发者ID:Phlogistique,项目名称:qibuild,代码行数:32,代码来源:list.py
示例9: split_debug
def split_debug(self, destdir, file_list):
""" Split debug symbols after install """
if self.using_visual_studio:
raise Exception("split debug not supported on Visual Studio")
ui.info(ui.green, "Splitting debug symbols from binaries ...")
tool_paths = dict()
for name in ["objcopy", "objdump"]:
tool_path = qibuild.cmake.get_binutil(name,
build_dir=self.build_directory,
env=self.build_env)
tool_paths[name] = tool_path
missing = [x for x in tool_paths if not tool_paths[x]]
if missing:
mess = """\
Could not split debug symbols from binaries for project {name}.
The following tools were not found: {missing}\
"""
mess = mess.format(name=self.name, missing = ", ".join(missing))
ui.warning(mess)
return
for filename in file_list:
full_path = os.path.join(destdir, filename[1:]) # remove starting /
if qibuild.gdb.is_elf(full_path):
qibuild.gdb.split_debug(full_path, **tool_paths)
开发者ID:cameronyoyos,项目名称:qibuild,代码行数:25,代码来源:project.py
示例10: read_remote_manifest
def read_remote_manifest(self, manifest_xml=None, warn_if_missing_group=True):
""" Read the manifest file in .qi/manifests/<name>/manifest.xml
using the settings in .qi/manifest.xml (to know the name and the groups
to use)
"""
if not manifest_xml:
manifest_xml = os.path.join(self.manifest_repo, "manifest.xml")
remote_manifest = qisrc.manifest.Manifest(manifest_xml, review=self.manifest.review)
groups = self.manifest.groups
# if self.manifest.groups is empty but there is a default
# group in the manifest, we need to set self.manifest.groups
# so that subsequent calls to qisrc add-group, remove-group
# work
if self.manifest.groups is None:
default_group = remote_manifest.groups.default_group
if default_group:
self.manifest.groups = [default_group.name]
# Maybe some groups were removed from the manifest.
# Only consider those which exist
if groups is None:
groups_to_use = None
else:
groups_to_use = list()
for group in groups:
if group in remote_manifest.groups.group_names:
groups_to_use.append(group)
else:
if warn_if_missing_group:
ui.warning("Group %s not found in the manifest" % group)
repos = remote_manifest.get_repos(groups=groups_to_use)
return repos
开发者ID:Phlogistique,项目名称:qibuild,代码行数:31,代码来源:sync.py
示例11: configure_branch
def configure_branch(self, name, tracks="origin",
remote_branch=None, default=True,
quiet=False):
""" Configure a branch. If a branch with the same name
already exists, update its tracking remote.
"""
previous_default_branch = self.default_branch
if previous_default_branch and previous_default_branch.name != name:
if not quiet:
ui.warning(self.src, ": default branch changed",
previous_default_branch.name, "->", name)
previous_default_branch.default = False
branch_found = False
for branch in self.branches:
if branch.name == name:
branch_found = True
if branch.tracks != tracks:
if not quiet:
ui.warning(self.src, ":", branch.name, "now tracks", tracks,
"instead of", branch.tracks)
branch.tracks = tracks
branch.default = default
if not branch_found:
branch = qisrc.git_config.Branch()
branch.name = name
branch.tracks = tracks
branch.remote_branch = remote_branch
branch.default = default
self.branches.append(branch)
return branch
开发者ID:Grimy,项目名称:qibuild,代码行数:31,代码来源:project.py
示例12: ask_gerrit_username
def ask_gerrit_username(server, ssh_port=29418):
"""
Run a wizard to try to configure gerrit access
If that fails, ask the user for its username
If that fails, give up and suggest upload the public key
"""
ui.info(ui.green, "Configuring gerrit ssh access ...")
username = os.environ.get("GERRIT_USER", qisys.sh.username())
if not username:
username = qisys.interact.ask_string("Please enter your username")
if not username:
return None
ui.info("Checking gerrit connection with %[email protected]%s:%i" %
(username, server, ssh_port))
if check_gerrit_connection(username, server, ssh_port=ssh_port):
ui.info("Success")
return username
ui.warning("Could not connect to ssh using username", username)
try_other = qisys.interact.ask_yes_no("Do you want to try with another username?")
if not try_other:
return None
username = qisys.interact.ask_string("Please enter your username")
if not username:
return None
if check_gerrit_connection(username, server, ssh_port=ssh_port):
return username
return None
开发者ID:aldebaran,项目名称:qibuild,代码行数:27,代码来源:review.py
示例13: read_remote_config
def read_remote_config(self, repo, quiet=False):
""" Apply the configuration read from the "repo" setting
of a remote manifest.
Called by WorkTreeSyncer
"""
previous_default = None
if self.default_remote:
previous_default = self.default_remote.name
self.name = repo.project
self.remotes = list()
for remote in repo.remotes:
self.configure_remote(remote)
if repo.default_branch and repo.default_remote:
self.configure_branch(repo.default_branch, tracks=repo.default_remote.name,
remote_branch=repo.default_branch, default=True,
quiet=quiet)
new_default = self.default_remote.name
if previous_default is not None and previous_default != new_default:
if not quiet:
ui.warning("Default remote changed", previous_default, "->",
new_default)
self.review = False
if repo.review:
ok = qisrc.review.setup_project(self)
if ok:
self.review = True
开发者ID:Grimy,项目名称:qibuild,代码行数:28,代码来源:project.py
示例14: get_git_projects
def get_git_projects(self, groups=None):
""" Get the git projects matching a given group """
if not groups:
return self.git_projects
res = set()
git_project_names = dict()
group_names = groups
for git_project in self.git_projects:
git_project_names[git_project.name] = git_project
projects = list()
groups = qisrc.groups.get_groups(self.worktree)
for group_name in group_names:
warn_for_group = True
project_names = groups.projects(group_name)
for project_name in project_names:
git_project = git_project_names.get(project_name)
if git_project:
res.add(git_project)
else:
if warn_for_group:
ui.warning("Group", group_name, "is not currently in use\n",
"Please use `qisrc add-group %s`" % group_name)
warn_for_group = False
res = list(res)
res.sort(key=operator.attrgetter("src"))
return res
开发者ID:Phlogistique,项目名称:qibuild,代码行数:27,代码来源:worktree.py
示例15: configure_qtcreator
def configure_qtcreator(qibuild_cfg):
""" Configure QtCreator
"""
ide = qibuild.config.IDE()
ide.name = "QtCreator"
build_env = qibuild.config.get_build_env()
qtcreator_path = qisys.command.find_program("qtcreator", env=build_env)
if qtcreator_path:
ui.info(ui.green, "::", ui.reset, "Found QtCreator:", qtcreator_path)
mess = "Do you want to use qtcreator from %s?\n" % qtcreator_path
mess += "Answer 'no' if you installed qtcreator from Nokia's installer"
answer = qisys.interact.ask_yes_no(mess, default=True)
if not answer:
qtcreator_path = None
else:
ui.warning("QtCreator not found")
if not qtcreator_path:
qtcreator_path = qisys.interact.ask_program(
"Please enter full qtcreator path")
if not qtcreator_path:
ui.warning("Not adding config for QtCreator",
"qibuild open will not work", sep="\n")
return
ide.path = qtcreator_path
qibuild_cfg.add_ide(ide)
开发者ID:gnatali,项目名称:qibuild,代码行数:26,代码来源:wizard.py
示例16: 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
示例17: no_project_args_on_root
def no_project_args_on_root(worktree):
""" Called when user ran a qisys.command at the top
of a worktree.
"""
wt_root = worktree.root
qiproj_xml = os.path.join(wt_root, "qiproject.xml")
if os.path.exists(qiproj_xml):
mess = """ Found a qiproject.xml at the root of the worktree
(in {qiproj_xml})
This is not recommended. You should create your worktree at
the parent directory instead
Please remove {dot_qi} and run:
cd {parent}
qibuild init
to do so
"""
parent = os.path.join(wt_root, "..")
parent = os.path.abspath(parent)
mess = mess.format(qiproj_xml=qiproj_xml, wt_root=wt_root,
parent=parent,
dot_qi=os.path.join(wt_root, ".qi"))
ui.warning(mess, end="")
else:
mess = """No project specified
Please specify the name or the path of a project
or go to the subdirectory of a project
Tip: use `qibuild list' to get the list of known projects"""
raise Exception(mess)
开发者ID:gnatali,项目名称:qibuild,代码行数:35,代码来源:cmdparse.py
示例18: do
def do(args):
""" Main method """
worktree = qisys.worktree.open_worktree(args.worktree)
if not worktree.projects:
on_empty_worktree(worktree)
regex = args.pattern
if args.pattern:
regex = re.compile(regex)
mess = [ui.green, "Projects in :", ui.reset, ui.bold, worktree.root]
if args.pattern:
mess.extend([ui.green, "matching", args.pattern])
ui.info(*mess)
to_remove = list()
for project in worktree.projects:
if not regex or regex.search(project.src):
ui.info(ui.green, " *", ui.blue, project.src)
if not os.path.exists(project.path):
to_remove.append(project.src)
if not to_remove:
return
mess = "The following projects:\n"
for rm in to_remove:
mess += " * " + rm + "\n"
mess += "are registered in the worktree, but their paths no longer exists"
ui.warning(mess)
answer = qisys.interact.ask_yes_no("Do you want to remove them", default=True)
if not answer:
return
for rm in to_remove:
ui.info(ui.green, "Removing", rm)
worktree.remove_project(rm)
开发者ID:bithium,项目名称:qibuild,代码行数:31,代码来源:list.py
示例19: do
def do(args):
"""
Add a package to a toolchain
- Check that there is a current toolchain
- Add the package to the cache
- Add the package from cache to toolchain
"""
toolchain = qitoolchain.parsers.get_toolchain(args)
package_path = args.package_path
legacy = False
try:
if urlparse.urlparse(package_path).scheme:
package_path = qisys.remote.download(package_path, ".")
archive = zipfile.ZipFile(package_path, allowZip64=True)
archive.read("package.xml")
except KeyError:
legacy = True
if legacy and not args.name:
raise Exception("Must specify --name when using legacy format")
if args.name and not legacy:
ui.warning("--name ignored when using modern format")
package = None
if legacy:
package = qitoolchain.qipackage.QiPackage(args.name)
else:
package = qitoolchain.qipackage.from_archive(package_path)
# extract it to the default packages path of the toolchain
tc_name = toolchain.name
tc_packages_path = qitoolchain.toolchain.get_default_packages_path(tc_name)
dest = os.path.join(tc_packages_path, package.name)
qisys.sh.rm(dest)
qitoolchain.qipackage.extract(package_path, dest)
package.path = dest
# add the package to the toolchain
toolchain.add_package(package)
开发者ID:aldebaran,项目名称:qibuild,代码行数:35,代码来源:add_package.py
示例20: get_ide
def get_ide(qibuild_cfg):
"""Return an IDE to use."""
known_ides = qibuild_cfg.ides.values()
ide_names = qibuild_cfg.ides.keys()
if not known_ides:
ui.warning("No IDE configured yet")
ui.info("Tips: use `qibuild config --wizard` to configure an IDE")
return None
# Remove the one that are not supported:
supported_ides = [x for x in known_ides if x.name in SUPPORTED_IDES]
if len(supported_ides) == 1:
return supported_ides[0]
if not supported_ides:
mess = "Found those IDEs in configuration: %s\n" % ", ".join(ide_names)
mess += "But `qibuild open` only supports: %s\n" % ", ".join(SUPPORTED_IDES)
raise Exception(mess)
# User chose a specific config and an IDE matches this config
if qibuild_cfg.ide:
return qibuild_cfg.ide
supported_names = [x.name for x in supported_ides]
# Several IDEs, ask the user to choose
ide_name = qisys.interact.ask_choice(supported_names,
"Please choose an IDE to use")
if not ide_name:
return None
return qibuild_cfg.ides[ide_name]
开发者ID:cameronyoyos,项目名称:qibuild,代码行数:32,代码来源:open.py
注:本文中的qisys.ui.warning函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论