本文整理汇总了Python中subprocess.Popen.sort方法的典型用法代码示例。如果您正苦于以下问题:Python Popen.sort方法的具体用法?Python Popen.sort怎么用?Python Popen.sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类subprocess.Popen
的用法示例。
在下文中一共展示了Popen.sort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Popen
# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import sort [as 别名]
'qemu-old',
'stp/papers/',
'stp/tests',
# The following directory contains a symlink to /dev/random
# which makes QtCreator search go crazy
'klee/runtime/POSIX/testing-dir',
]
if os.path.isdir('.git'):
git_files = Popen(['git', 'ls-files'],
stdout=PIPE).communicate()[0].split('\n')
else:
sys.stderr.write('This is not a git repository!\n')
sys.exit(1)
git_files.sort()
dirs = set([""])
s2e_files = open('s2e.files', 'w')
s2e_includes = open('s2e.includes', 'w')
for fname in git_files:
for b in blacklist:
if fname.startswith(b):
break
else:
if not os.path.isdir(fname):
s2e_files.write(fname + '\n')
fdir = fname
while fdir != "":
fdir = os.path.dirname(fdir)
示例2: list_branches
# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import sort [as 别名]
def list_branches(self):
'list existing branches, with current branch first'
l = Popen(["git", "branch"], stdout=PIPE).communicate()[0].split('\n')[:-1]
l.sort(reverse=True) # force starred branch to be first
return [s[2:] for s in l]