本文整理汇总了Python中qisys.ui.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dump_symbols_from_binary
def dump_symbols_from_binary(binary, pool_dir, dump_syms_executable=None):
""" Dump sympobls from the binary.
Results can be found in
<pool_dir>/<binary name>/<id>/<binary name>.sym
"""
cmd = [dump_syms_executable, binary]
ui.debug(cmd)
process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
(out, err) = process.communicate()
if process.returncode != 0:
ui.error("Failed to dump symbols", err)
return
# First line looks like:
# MODULE Linux x86_64 ID binary
lines = out.splitlines()
first_line = lines[0]
uuid = first_line.split()[3]
name = first_line.split()[4]
to_make = os.path.join(pool_dir, name, uuid)
qisys.sh.mkdir(to_make, recursive=True)
with open(os.path.join(to_make, name + ".sym"), "w") as fp:
fp.write(out)
示例2: target
def target():
ui.debug("Starting thread.")
ui.debug("Calling:", subprocess.list2cmdline(self.cmd))
try:
opts = dict()
if os.name == 'posix':
opts = {
'preexec_fn': os.setsid,
'close_fds': True
}
elif os.name == 'nt':
opts = {
'creationflags': subprocess.CREATE_NEW_PROCESS_GROUP,
}
kwargs = {
"cwd": self.cwd,
"env" : self.env
}
kwargs.update(opts)
if self.capture:
kwargs["stdout"] = subprocess.PIPE
kwargs["stderr"] = subprocess.STDOUT
self._process = subprocess.Popen(self.cmd, **kwargs)
except Exception, e:
self.exception = e
self.return_type = Process.NOT_RUN
return
示例3: jar
def jar(jar_path, files, paths):
""" Search each files using qibuild find and
add them into a jar using qisys
"""
# Create command line
jar_path = qisys.sh.to_native_path(jar_path)
args = ["cvfM"]
args += [jar_path]
if not files:
raise Exception("Missing arguments : Files to package")
for wanted_file in files:
ui.info("Searching for " + wanted_file + "...")
path = qibuild.find.find(paths, wanted_file, expect_one=False)[0]
if not path:
ui.error("Cannot find " + wanted_file + " in worktree")
return None
ui.debug("Found : " + path)
dirname = os.path.dirname(path)
basename = os.path.basename(path)
args += ["-C", dirname, basename]
ui.debug("Added -C " + dirname + " " + wanted_file + " to command line")
qisys.command.call(["jar"] + args, ignore_ret_code=False)
return jar_path
示例4: call
def call(self, *args, **kwargs):
""" Call """
if "cwd" not in kwargs.keys():
kwargs["cwd"] = self.path
ui.debug("svn", " ".join(args), "in", kwargs["cwd"])
if "quiet" not in kwargs.keys():
kwargs["quiet"] = False
svn = qisys.command.find_program("svn", raises=True)
cmd = [svn]
cmd.extend(args)
raises = kwargs.get("raises")
if raises is False:
del kwargs["raises"]
del kwargs["quiet"]
process = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
**kwargs)
out = process.communicate()[0]
# Don't want useless blank lines
out = out.rstrip("\n")
ui.debug("out:", out)
return process.returncode, out
else:
if "raises" in kwargs:
del kwargs["raises"]
qisys.command.call(cmd, **kwargs)
return None
示例5: on_dependent_job_finished
def on_dependent_job_finished(self, job):
with self.lock:
try:
self.deps.remove(job)
except ValueError:
ui.debug(ui.red, "Job not in the deps list!", self.deps, job)
pass
示例6: _compress_zip
def _compress_zip(directory, quiet=True, verbose=False, flat=False, output=None):
"""Compress directory in a .zip file
:param directory: directory to add to the archive
:param archive_basepath: output archive basepath (without extension)
:param quiet: quiet mode (print nothing)
:return: path to the generated archive (archive_basepath.zip)
"""
if quiet and verbose:
mess = """Unconsistent arguments: both 'quiet' and 'verbose' options are set.
Please set only one of these two options to 'True'
"""
raise ValueError(mess)
ui.debug("Compressing", directory, "to", output)
archive = zipfile.ZipFile(output, "w", zipfile.ZIP_DEFLATED)
for root, _, filenames in os.walk(directory):
for filename in filenames:
full_path = os.path.join(root, filename)
# Do not zip ourselves
if full_path == output:
continue
rel_path = os.path.relpath(full_path, directory)
if flat:
arcname = rel_path
else:
arcname = os.path.join(os.path.basename(directory), rel_path)
if not quiet:
sys.stdout.write("adding {0}\n".format(rel_path))
sys.stdout.flush()
if not qisys.sh.broken_symlink(full_path):
archive.write(full_path, arcname)
archive.close()
return output
示例7: run
def run(projects, binary, bin_args, env=None, exec_=True):
""" Find binary in worktree and
exec it with given arguments.
"""
paths = list()
for proj in projects:
paths += [proj.sdk_directory]
if os.path.exists(binary):
bin_path = qisys.sh.to_native_path(binary)
else:
bin_path = None
candidates = qibuild.find.find_bin(paths, binary, expect_one=False)
if len(candidates) == 1:
bin_path = candidates[0]
if len(candidates) > 1:
bin_path = qisys.interact.ask_choice(candidates,
"Please select a binary to run")
if not bin_path:
bin_path = qisys.command.find_program(binary)
if not bin_path:
raise Exception("Cannot find " + binary + " binary")
cmd = [bin_path] + bin_args
if exec_:
ui.debug("exec", cmd)
os.execve(bin_path, cmd, env)
else:
qisys.command.call(cmd, env=env)
示例8: handle_pure_python
def handle_pure_python(venv_path, python_worktree, env=None):
""" Add the paths of all python projects to the virtualenv """
lib_path = virtualenv.path_locations(venv_path)[1]
qi_pth_dest = os.path.join(venv_path, lib_path, "site-packages/qi.pth")
res = True
with open(qi_pth_dest, "w") as fp:
fp.write("")
for i, project in enumerate(python_worktree.python_projects):
ui.info_count(i, len(python_worktree.python_projects),
ui.blue, project.name)
if project.setup_with_distutils:
cmd = [python_worktree.pip, "install"]
if not ui.CONFIG["verbose"]:
cmd.append("--quiet")
cmd.extend(["--editable", "."])
rc = qisys.command.call(cmd, cwd=project.path, ignore_ret_code=True,
env=env)
if rc != 0:
ui.warning("Failed to run pip install on", project.src)
res = False
else:
ui.debug("Adding python path for project", project.name, ":\n",
project.python_path)
for path in project.python_path:
fp.write(path + "\n")
return res
示例9: find_program
def find_program(executable, env=None, raises=False, build_config=None):
"""
Get the full path of an executable by
looking at PATH environment variable
(and PATHEXT on windows)
Toolchain binaries from build_config are also prepend to path.
:return: None if program was not found,
the full path to executable otherwise
"""
if executable in _FIND_PROGRAM_CACHE:
return _FIND_PROGRAM_CACHE[executable]
res = None
if not env:
env = dict(qibuild.config.get_build_env())
if not env:
env = dict(os.environ)
toolchain_paths = get_toolchain_binary_paths(build_config)
if toolchain_paths:
env["PATH"] = os.pathsep.join((toolchain_paths, env.get("PATH", "")))
for path in env["PATH"].split(os.pathsep):
res = _find_program_in_path(executable, path)
if res and _is_runnable(res):
ui.debug("Use %s from: %s" % (executable, res))
_FIND_PROGRAM_CACHE[executable] = res
return res
if raises:
raise NotInPath(executable, env=env)
return None
示例10: _call
def _call(self, *args, **kwargs):
""" Helper for self.call """
ui.debug("git", " ".join(args))
if not "cwd" in kwargs.keys():
kwargs["cwd"] = self.repo
if not "quiet" in kwargs.keys():
kwargs["quiet"] = False
git = qisys.command.find_program("git", raises=True)
cmd = [git]
cmd.extend(args)
raises = kwargs.get("raises")
if raises is False:
del kwargs["raises"]
del kwargs["quiet"]
process = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
**kwargs)
out = process.communicate()[0]
# Don't want useless blank lines
out = out.rstrip("\n")
ui.debug("out:", out)
return (process.returncode, out)
else:
if "raises" in kwargs:
del kwargs["raises"]
qisys.command.call(cmd, **kwargs)
示例11: run
def run(self, timeout=None):
def target():
ui.debug("Starting thread.")
ui.debug("Calling:", " ".join(self.cmd))
try:
opts = dict()
if os.name == 'posix':
opts = {
'preexec_fn': os.setsid,
'close_fds': True
}
elif os.name == 'nt':
opts = {
'creationflags': subprocess.CREATE_NEW_PROCESS_GROUP,
}
self._process = subprocess.Popen(self.cmd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
cwd=self.cwd,
env=self.env,
**opts)
except Exception, e:
self.exception = e
self.return_type = Process.NOT_RUN
return
self.out = self._process.communicate()[0]
self.returncode = self._process.returncode
if self.returncode == 0:
self.return_type = Process.OK
ui.debug("Thread terminated.")
示例12: find_installed_cmake_qibuild_dir
def find_installed_cmake_qibuild_dir(python_dir):
ui.debug("looking for cmake code from", python_dir)
for candidate in [
# python in qibuild/python, cmake in qibuild/cmake
("..", "..", "cmake"),
# python in lib/python-2.7/{dist,site}-packages,
# cmake in share/cmake/
# (default pip)
("..", "..", "..", "..", "share", "cmake"),
# python in local/lib/python-2.7/{dist,site}-packages,
# cmake in share/cmake
# (debian's pip)
("..", "..", "..", "..", "..", "share", "cmake"),
# python in Python27\Lib\{dist,site}-packages
# cmake in Python27\share\cmake
# (windows' pip)
("..", "..", "..", "share", "cmake"),
# python in qibuild.egg/qibuild,
# cmake in qibuild.egg/share/cmake
# (pip with setuptools)
("..", "share", "cmake"),
# pip on mac
(sys.prefix, "share", "cmake")
]:
rel_path = os.path.join(*candidate)
res = os.path.join(python_dir, rel_path)
res = qisys.sh.to_native_path(res)
qibuild_config = os.path.join(res, "qibuild", "qibuild-config.cmake")
ui.debug("trying", qibuild_config)
if os.path.exists(qibuild_config):
return res
示例13: get_server_access
def get_server_access(self, server_name):
""" Return the access settings of a server. """
server = self.servers.get(server_name)
ui.debug("access for", server_name, ":", server)
if not server:
return None
return server.access
示例14: _resolve_job_build_dependencies
def _resolve_job_build_dependencies(self, job):
for p in job.project.build_depends:
dep_job = self._find_job_by_name(p)
if dep_job:
job.add_dependency(dep_job)
else:
ui.debug("Job {job}: Couldn't find the job for the project dependency {dep}". \
format(job=job.project.name, dep=p))
示例15: _kill_subprocess
def _kill_subprocess(self):
if self._thread and self._process:
ui.debug('Terminating process.')
self._process.terminate()
self.return_type = Process.TIME_OUT
self._thread.join(5)
if self._thread.is_alive():
self._destroy_zombie()