本文整理汇总了Python中src.common.utils.debugger函数的典型用法代码示例。如果您正苦于以下问题:Python debugger函数的具体用法?Python debugger怎么用?Python debugger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debugger函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_disk_mount
def get_disk_mount(disk_id):
TEMP_DIR = 'C:\\temp\\kano-burner\\'
disk_mount = '' # mount point e.g. C:\ or D:\
# extract the id of the physical disk, required by diskpart
# e.g. \\?\Device\Harddisk[id]\Partition0
id = int(disk_id.split("Harddisk")[1][0]) # access by string index alone is dangerous!
# create a diskpart script to find the mount point for the given disk
diskpart_detail_script = 'select disk {} \ndetail disk'.format(id)
write_file_contents(TEMP_DIR + "detail_disk.txt", diskpart_detail_script)
# run the created diskpart script
cmd = 'diskpart /s {}'.format(TEMP_DIR + "detail_disk.txt")
output, error, return_code = run_cmd_no_pipe(cmd)
if not return_code:
debugger('Ran diskpart detail script')
else:
debugger('[ERROR] ' + error.strip('\n'))
return
# now the mount point is the third word on the last line of the output
disk_mount = output.splitlines()[-1].split()[2]
return disk_mount
开发者ID:elyscape,项目名称:kano-burners,代码行数:26,代码来源:disk.py
示例2: test_write
def test_write(disk_mount):
cmd = '{}\\dd.exe if=/dev/random of=\\\\.\\{}: bs=4M count=10'.format(_dd_path, disk_mount)
_, output, return_code = run_cmd_no_pipe(cmd)
if not return_code:
debugger('Written 40M random data to {}:\\'.format(disk_mount))
else:
debugger('[ERROR]: ' + output.strip('\n'))
开发者ID:elyscape,项目名称:kano-burners,代码行数:8,代码来源:disk.py
示例3: format_disk
def format_disk(disk_id):
cmd = 'mkdosfs -I -F 32 -v {}'.format(disk_id)
_, error, return_code = run_cmd(cmd)
if not return_code:
debugger('{} successfully erased and formatted'.format(disk_id))
else:
debugger('[ERROR] ' + error.strip('\n'))
开发者ID:elyscape,项目名称:kano-burners,代码行数:8,代码来源:disk.py
示例4: close_all_explorer_windows
def close_all_explorer_windows():
cmd = '{}\\nircmd.exe win close class "CabinetWClass"'.format(_nircmd_path)
_, error, return_code = run_cmd_no_pipe(cmd)
if not return_code:
debugger('Closed all Explorer windows')
else:
debugger('[ERROR]: ' + error.strip('\n'))
开发者ID:KanoComputing,项目名称:kano-burners,代码行数:8,代码来源:disk.py
示例5: unmount_disk
def unmount_disk(disk_id):
cmd = 'diskutil unmountDisk {}'.format(disk_id)
_, error, return_code = run_cmd(cmd)
if not return_code:
debugger('{} successfully unmounted'.format(disk_id))
else:
debugger('[ERROR] ' + error.strip('\n'))
开发者ID:elyscape,项目名称:kano-burners,代码行数:8,代码来源:disk.py
示例6: unzip_kano_os
def unzip_kano_os(os_path, dest_path):
cmd = '"{}\\7za.exe" e "{}" -o"{}"'.format(_7zip_path, os_path, dest_path)
_, output, return_code = run_cmd_no_pipe(cmd)
if not return_code:
debugger('Unzipped Kano OS successfully')
else:
debugger('[ERROR]: ' + output.strip('\n'))
开发者ID:KanoComputing,项目名称:kano-burners,代码行数:8,代码来源:burn.py
示例7: get_disk_ids
def get_disk_ids():
cmd = "diskutil list | grep '/dev/'"
output, error, return_code = run_cmd(cmd)
if not return_code:
return output.split()
else:
debugger('[ERROR] ' + error.strip('\n'))
开发者ID:elyscape,项目名称:kano-burners,代码行数:8,代码来源:disk.py
示例8: is_installed
def is_installed(programs_list):
cmd = 'which {}'.format(' '.join(programs_list))
output, error, return_code = run_cmd(cmd)
if return_code:
debugger('[ERROR] ' + error.strip('\n'))
return True # if something goes wrong here, it shouldn't be catastrophic
return len(output.split()) == len(programs_list)
开发者ID:elyscape,项目名称:kano-burners,代码行数:9,代码来源:dependency.py
示例9: unmount_disk
def unmount_disk(disk_id):
cmd = 'diskutil unmountDisk {}'.format(disk_id)
_, error, return_code = run_cmd(cmd)
if not return_code:
debugger('{} successfully unmounted'.format(disk_id))
else:
debugger('[ERROR: {}] {}'.format(cmd, error.strip('\n')))
raise disk_error(UNMOUNT_ERROR)
开发者ID:langgaibo,项目名称:kano-burners,代码行数:9,代码来源:disk.py
示例10: getAriaStatus
def getAriaStatus(self):
self.process.poll()
if not self.process.returncode:
try:
self.ariaStatus = self.server.aria2.tellStatus('token:'+self.secret, self.gid)
if not isinstance(self.ariaStatus, dict):
self.ariaStatus = {}
except Exception as e:
self.failed = True
self.failure = e
debugger('status call error {}'.format(e))
开发者ID:ektor5,项目名称:kano-burners,代码行数:11,代码来源:aria2_downloader.py
示例11: is_sufficient_space
def is_sufficient_space(path, required_mb):
cmd = "df %s | grep -v 'Available' | awk '{print $4}'" % path
output, _, _ = run_cmd(cmd)
try:
free_space_mb = float(output.strip()) * 512 / BYTES_IN_MEGABYTE
except:
debugger('[ERROR] Failed parsing the line ' + output)
return True
debugger('Free space {0:.2f} MB in {1}'.format(free_space_mb, path))
return free_space_mb > required_mb
开发者ID:elyscape,项目名称:kano-burners,代码行数:12,代码来源:dependency.py
示例12: mount_disk
def mount_disk(disk_id):
# the following may not work if the disk has been unmounted, consider caching
disk_mount = get_disk_mount(disk_id)
disk_volume = get_disk_volume(disk_id, disk_mount)
cmd = "mountvol {}:\\ {}".format(disk_mount, disk_volume)
_, error, return_code = run_cmd_no_pipe(cmd)
if not return_code:
debugger('{} successfully mounted'.format(disk_mount))
else:
debugger('[ERROR]: ' + error.strip('\n'))
开发者ID:elyscape,项目名称:kano-burners,代码行数:12,代码来源:disk.py
示例13: isFinished
def isFinished(self):
self.process.poll()
if self.process.returncode:
debugger('aria returned {}'.format(self.status.returncode))
return True # aria finished; since it's not supposed to until we tell it, it probably died
if self.failed:
debugger('aria failed {}'.format(self.failure))
return True
self.getAriaStatus()
result = self.ariaStatus['status']
finished = result != 'active' and result != 'waiting'
return finished
开发者ID:ektor5,项目名称:kano-burners,代码行数:13,代码来源:aria2_downloader.py
示例14: get_disk_sizes
def get_disk_sizes():
cmd = "fdisk -l | grep 'Disk /dev/'"
output, error, return_code = run_cmd(cmd)
disk_sizes = []
for line in sorted(output.splitlines()):
size = line.split()[4]
disk_sizes.append(float(size) / BYTES_IN_GIGABYTE)
if return_code:
debugger('[ERROR] ' + error.strip('\n'))
return disk_sizes
开发者ID:elyscape,项目名称:kano-burners,代码行数:13,代码来源:disk.py
示例15: eject_disk
def eject_disk(disk_id):
'''
This method is used by the backendThread to ensure safe removal
after burning finished successfully.
'''
cmd = 'diskutil eject {}'.format(disk_id)
_, error, return_code = run_cmd(cmd)
if not return_code:
debugger('{} successfully ejected'.format(disk_id))
else:
debugger('[ERROR] ' + error.strip('\n'))
开发者ID:elyscape,项目名称:kano-burners,代码行数:13,代码来源:disk.py
示例16: get_disk_names
def get_disk_names():
cmd = "parted --list | grep 'Model:'"
output, error, return_code = run_cmd(cmd)
disk_names = []
for name in output.splitlines():
disk_names.append(' '.join(name.split()[1:-1]))
if return_code:
debugger('[ERROR] ' + error.strip('\n'))
# grab the first line of the output and the name is from the 4th word onwards
return disk_names
开发者ID:elyscape,项目名称:kano-burners,代码行数:13,代码来源:disk.py
示例17: poll_burning_thread
def poll_burning_thread(thread):
time.sleep(1) # wait for dd to start
debugger('Polling burner for progress..')
cmd = 'kill -INFO `pgrep ^dd`'
# as long as the burning thread is running, send SIGINFO
# to dd to trigger progress output
while thread.is_alive():
_, error, return_code = run_cmd(cmd)
if return_code:
debugger('[ERROR] Sending signal to burning thread failed')
return False
time.sleep(0.3)
return True
开发者ID:KanoComputing,项目名称:kano-burners,代码行数:14,代码来源:burn.py
示例18: is_installed
def is_installed(programs_list):
cmd = 'where.exe {}'.format(' '.join(programs_list))
output, error, return_code = run_cmd_no_pipe(cmd)
if return_code:
debugger('[ERROR] ' + error.strip('\n'))
return True # if something goes wrong here, it shouldn't be catastrophic
programs_found = 0
for line in output.splitlines():
if line and 'not find' not in line:
programs_found += 1
return programs_found == len(programs_list)
开发者ID:KanoComputing,项目名称:kano-burners,代码行数:14,代码来源:dependency.py
示例19: unmount_volumes
def unmount_volumes(disk_id):
# all volumes on a disk have an index attached e.g. /dev/sdb1, /dev/sdb2
cmd = "fdisk -l | grep '%s[0-9][0-9]*' | awk '{print $1}'" % disk_id
output, _, _ = run_cmd(cmd)
# it may also happen that the disk does not have volumes
# in which case the loop below won't do anything
for volume in output.splitlines():
cmd = 'umount {}'.format(volume)
_, error, return_code = run_cmd(cmd)
if not return_code:
debugger('volume {} successfully unmounted'.format(volume))
else:
debugger('[ERROR] ' + error.strip('\n'))
开发者ID:elyscape,项目名称:kano-burners,代码行数:14,代码来源:disk.py
示例20: is_sufficient_space
def is_sufficient_space(required_mb):
cmd = "dir {}".format(temp_path)
output, _, _ = run_cmd_no_pipe(cmd)
try:
# grab the last line from the output
free_space_line = output.splitlines()[-1]
# grab the number in bytes, remove comma delimiters, and convert to MB
free_space_mb = float(free_space_line.split()[2].replace(',', '')) / BYTES_IN_MEGABYTE
except:
debugger('[ERROR] Failed parsing the line ' + output)
return True
debugger('Free space {0:.2f} MB in {1}'.format(free_space_mb, temp_path))
return free_space_mb > required_mb
开发者ID:KanoComputing,项目名称:kano-burners,代码行数:16,代码来源:dependency.py
注:本文中的src.common.utils.debugger函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论