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