本文整理汇总了Python中util.run_cmd_throw函数的典型用法代码示例。如果您正苦于以下问题:Python run_cmd_throw函数的具体用法?Python run_cmd_throw怎么用?Python run_cmd_throw使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_cmd_throw函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_efi_result
def build_efi_result(ver):
path = efi_result_file(ver)
if os.path.exists(path):
return # was already done
os.chdir(sum_efi_cache_dir(ver))
util.run_cmd_throw("efi", "SumatraPDF.exe", ">efi.txt")
util.bz_file_compress("efi.txt", "efi.txt.bz2")
示例2: zip_one_file
def zip_one_file(dir, to_pack, zip_name):
verify_path_exists(dir)
# for the benefit of pigz, we have to cd to the directory, because
# we don't control the name of the file inside created zip file - it's
# the same as path of the file we're compressing
curr_dir = os.getcwd()
os.chdir(dir)
verify_path_exists(to_pack)
util.delete_file(zip_name) # ensure destination doesn't exist
try:
# -11 for zopfil compression
# --keep to not delete the source file
# --zip to create a single-file zip archive
# we can't control the name of the file pigz will create, so rename
# to desired name after it's created
pigz_dst = to_pack + ".zip"
util.delete_file(pigz_dst)
run_cmd_throw("pigz", "-11", "--keep", "--zip", to_pack)
print("Compressed using pigz.exe")
if pigz_dst != zip_name:
print("moving %s => %s" % (pigz_dst, zip_name))
shutil.move(pigz_dst, zip_name)
except:
# if pigz.exe is not in path, use regular zip compression
zip_file(zip_name, to_pack, to_pack, compress=True)
print("Compressed using regular zip")
verify_path_exists(zip_name)
os.chdir(curr_dir)
示例3: fix_from_ver
def fix_from_ver(ver, all_vers, all_vers_s3):
to_delete = {}
for v in all_vers:
if v >= ver:
to_delete[v] = True
for v in all_vers_s3:
if v >= ver:
to_delete[v] = True
to_delete = to_delete.keys()
if len(to_delete) > 10: # safety check
to_delete.sort()
to_delete.reverse()
print(to_delete)
print("won't delete because too many version: %d" % len(to_delete))
return
map(delete_ver, to_delete)
src_path = os.path.join("..", "sumatrapdf_buildbot")
verify_path_exists(src_path)
os.chdir(src_path)
run_cmd_throw("svn", "update", "-r", str(ver))
print("Finished fixing")
sys.exit(1)
示例4: main
def main():
if len(sys.argv) < 2:
usage_and_exit()
#print("top_dir: '%s'" % get_top_dir())
ensure_7z_exists()
conf = util.load_config()
cert_pwd = conf.GetCertPwdMustExist()
s3.set_secrets(conf.aws_access, conf.aws_secret)
s3.set_bucket("kjkpub")
ver = sys.argv[1]
#print("ver: '%s'" % ver)
svn_url = "https://sumatrapdf.googlecode.com/svn/tags/%srel" % ver
src_dir_name = "SumatraPDF-%s-src" % ver
archive_name = src_dir_name + ".7z"
s3_path = "sumatrapdf/rel/" + archive_name
print("svn_url: '%s'\ndir_name: '%s'\narchive_name: %s\ns3_path: %s" % (svn_url, src_dir_name, archive_name, s3_path))
s3.verify_doesnt_exist(s3_path)
os.chdir(get_top_dir())
util.run_cmd_throw("svn", "export", svn_url, src_dir_name)
util.run_cmd_throw("7z", "a", "-r", archive_name, src_dir_name)
s3.upload_file_public(archive_name, s3_path)
shutil.rmtree(src_dir_name)
os.remove(archive_name)
示例5: build_release
def build_release(stats, ver):
config = "CFG=rel"
obj_dir = "obj-rel"
extcflags = "EXTCFLAGS=-DSVN_PRE_RELEASE_VER=%s" % ver
platform = "PLATFORM=X86"
shutil.rmtree(obj_dir, ignore_errors=True)
shutil.rmtree(os.path.join("mupdf", "generated"), ignore_errors=True)
(out, err, errcode) = run_cmd("nmake", "-f", "makefile.msvc", config, extcflags, platform, "all_sumatrapdf")
log_path = os.path.join(get_logs_cache_dir(), ver + "_rel_log.txt")
build_log = out + "\n====STDERR:\n" + err
build_log = strip_empty_lines(build_log)
open(log_path, "w").write(build_log)
stats.rel_build_log = ""
stats.rel_failed = False
if errcode != 0:
stats.rel_build_log = build_log
stats.rel_failed = True
return
stats.rel_sumatrapdf_exe_size = file_size_in_obj("SumatraPDF.exe")
stats.rel_sumatrapdf_no_mupdf_exe_size = file_size_in_obj("SumatraPDF-no-MuPDF.exe")
stats.rel_libmupdf_dll_size = file_size_in_obj("libmupdf.dll")
stats.rel_nppdfviewer_dll_size = file_size_in_obj("npPdfViewer.dll")
stats.rel_pdffilter_dll_size = file_size_in_obj("PdfFilter.dll")
stats.rel_pdfpreview_dll_size = file_size_in_obj("PdfPreview.dll")
build_installer_data(obj_dir)
run_cmd_throw("nmake", "-f", "makefile.msvc", "Installer", config, platform, extcflags)
p = os.path.join(obj_dir, "Installer.exe")
stats.rel_installer_exe_size = file_size(p)
示例6: verify_flint_installed
def verify_flint_installed():
try:
util.run_cmd_throw("flint")
except:
print("flint doesn't seem to be installed")
print("https://github.com/facebook/flint")
sys.exit(1)
示例7: build_win
def build_win():
util.run_cmd_throw("premake4", "vs2010")
curr_dir = os.getcwd()
os.chdir("vs-premake")
util.kill_msbuild()
util.run_cmd_throw("devenv", "ag.sln", "/Build", "Release", "/Project", "ag.vcxproj")
assert os.path.exists(ag_exe_path_win()), "%s doesn't exist" % ag_exe_path_win()
os.chdir(curr_dir)
示例8: create_pdb_lzsa_archive
def create_pdb_lzsa_archive(dir, archive_name):
archive_path = os.path.join(dir, archive_name)
MakeLzsa = os.path.join(dir, "MakeLzsa.exe")
files = ["libmupdf.pdb", "Installer.pdb",
"SumatraPDF-no-MuPDF.pdb", "SumatraPDF.pdb"]
files = [os.path.join(dir, file) + ":" + file for file in files]
run_cmd_throw(MakeLzsa, archive_path, *files)
return archive_path
示例9: build
def build():
util.run_cmd_throw("premake4", "vs2010")
os.chdir("build")
util.kill_msbuild()
util.run_cmd_throw("devenv", "pigz.sln", "/Build", "Release", "/Project", "pigz.vcxproj")
os.chdir(os.path.join("..", "rel"))
assert os.path.exists("pigz.exe")
# yes, those are the same files, the binary decides what it is based on its name
shutil.copyfile("pigz.exe", "unpigz.exe")
示例10: build_and_upload_efi_out
def build_and_upload_efi_out(ver):
obj_dir = "obj-rel"
s3dir = "sumatrapdf/buildbot/%s/" % ver
os.chdir(obj_dir)
util.run_cmd_throw("efi", "SumatraPDF.exe", ">efi.txt")
util.bz_file_compress("efi.txt", "efi.txt.bz2")
s3.upload_file_public("efi.txt.bz2", s3dir + "efi.txt.bz2", silent=True)
shutil.copyfile("efi.txt.bz2", logs_efi_out_path(ver))
os.chdir("..")
示例11: run_tests
def run_tests(build_dir):
total = len(test_exes)
curr = 1
for f in test_exes:
p = os.path.join(build_dir, f)
print("Running test %d/%d %s" % (curr, total, p))
out, err = run_cmd_throw(p)
print(out + err)
curr += 1
p = os.path.join(build_dir, dbbench_exe)
print("Running %s" % p)
run_cmd_throw(p)
示例12: sign
def sign(file_path, cert_pwd):
# the sign tool is finicky, so copy it and cert to the same dir as
# exe we're signing
file_dir = os.path.dirname(file_path)
file_name = os.path.basename(file_path)
cert_src = os.path.join("scripts", "cert.pfx")
cert_dest = os.path.join(file_dir, "cert.pfx")
if not os.path.exists(cert_dest): shutil.copy(cert_src, cert_dest)
curr_dir = os.getcwd()
os.chdir(file_dir)
run_cmd_throw("signtool.exe", "sign", "/t", "http://timestamp.verisign.com/scripts/timstamp.dll",
"/du", "http://blog.kowalczyk.info/software/sumatrapdf/", "/f", "cert.pfx", "/p", cert_pwd, file_name)
os.chdir(curr_dir)
示例13: upload
def upload(ver):
svn_url = "https://sumatrapdf.googlecode.com/svn/tags/%srel" % ver
src_dir_name = "SumatraPDF-%s-src" % ver
archive_name = src_dir_name + ".7z"
s3_path = "sumatrapdf/rel/" + archive_name
print("svn_url: '%s'\ndir_name: '%s'\narchive_name: %s\ns3_path: %s" % (svn_url, src_dir_name, archive_name, s3_path))
s3.verify_doesnt_exist(s3_path)
os.chdir(get_top_dir())
util.run_cmd_throw("svn", "export", svn_url, src_dir_name)
util.run_cmd_throw("7z", "a", "-r", archive_name, src_dir_name)
s3.upload_file_public(archive_name, s3_path)
shutil.rmtree(src_dir_name)
os.remove(archive_name)
示例14: build_ver
def build_ver(ver):
print("Building release version %d" % ver)
obj_dir = "obj-rel"
if already_built(ver):
print("Version %d already built!" % ver)
return
os.chdir(sum_efi_dir())
util.run_cmd_throw("svn", "update", "-r%d" % ver)
build_clean(ver)
for f in g_build_artifacts:
src = os.path.join(obj_dir, f)
dst = os.path.join(sum_efi_cache_dir(ver), f)
shutil.copyfile(src, dst)
示例15: build_ver
def build_ver(ver):
print("Building release version %d" % ver)
config = "CFG=rel"
obj_dir = "obj-rel"
extcflags = "EXTCFLAGS=-DSVN_PRE_RELEASE_VER=%s" % ver
platform = "PLATFORM=X86"
if already_built(ver):
print("Version %d already built!" % ver)
return
os.chdir(sum_efi_dir())
util.run_cmd_throw("svn", "update", "-r%d" % ver)
shutil.rmtree(obj_dir, ignore_errors=True)
shutil.rmtree(os.path.join("mupdf", "generated"), ignore_errors=True)
(out, err, errcode) = util.run_cmd("nmake", "-f", "makefile.msvc", config, extcflags, platform, "all_sumatrapdf")
for f in g_build_artifacts:
src = os.path.join(obj_dir, f)
dst = os.path.join(sum_efi_cache_dir(ver), f)
shutil.copyfile(src, dst)