• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python synctool_lib.verbose函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中synctool_lib.verbose函数的典型用法代码示例。如果您正苦于以下问题:Python verbose函数的具体用法?Python verbose怎么用?Python verbose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了verbose函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: overlay_callback

def overlay_callback(obj):
	'''compare files and run post-script if needed'''
	
	verbose('checking %s' % obj.print_src())
	
	if obj.compare_files():
		run_post(obj.src_path, obj.dest_path)
开发者ID:gyepisam,项目名称:synctool,代码行数:7,代码来源:synctool.py


示例2: single_files

def single_files(filename):
	'''check/update a single file'''
	'''returns (True, path_in_synctree) if file is different'''
	
	if not filename:
		stderr('missing filename')
		return (False, None)
	
	(obj, err) = synctool_overlay.find_terse(synctool_overlay.OV_OVERLAY, filename)
	if err == synctool_overlay.OV_FOUND_MULTIPLE:
		# multiple source possible
		# possibilities have already been printed
		sys.exit(1)
	
	if err == synctool_overlay.OV_NOT_FOUND:
		stderr('%s is not in the overlay tree' % filename)
		return (False, None)
	
	verbose('checking against %s' % obj.print_src())
	
	changed = obj.compare_files()
	if not changed:
		stdout('%s is up to date' % filename)
		terse(synctool_lib.TERSE_OK, filename)
		unix_out('# %s is up to date\n' % obj.print_dest())
	
	return (changed, obj.src_path)
开发者ID:gyepisam,项目名称:synctool,代码行数:27,代码来源:synctool.py


示例3: run_remote_copy

def run_remote_copy(nodes, files):
    """copy files[] to nodes[]"""

    if not synctool_param.SCP_CMD:
        stderr(
            "%s: error: scp_cmd has not been defined in %s" % (os.path.basename(sys.argv[0]), synctool_param.CONF_FILE)
        )
        sys.exit(-1)

    scp_cmd_arr = shlex.split(synctool_param.SCP_CMD)

    if SCP_OPTIONS:
        scp_cmd_arr.extend(shlex.split(SCP_OPTIONS))

    for node in nodes:
        if node == synctool_param.NODENAME:
            verbose("skipping node %s" % node)
            nodes.remove(node)
            break

    scp_cmd_arr.extend(files)

    files_str = string.join(files)  # this is used only for printing

    synctool_lib.run_parallel(master_scp, worker_scp, (nodes, scp_cmd_arr, files_str), len(nodes))
开发者ID:samuelet,项目名称:synctool,代码行数:25,代码来源:synctool_scp.py


示例4: get_latest_version_and_checksum

def get_latest_version_and_checksum():
	'''get latest version and checksum by downloading the LATEST.txt versioning file'''

	verbose('accessing URL %s' % VERSION_CHECKING_URL)

	try:
		opener = urllib.FancyURLopener({})
		f = opener.open(VERSION_CHECKING_URL)
		data = f.read()	
		f.close()
	except:
		stderr('error accessing the file at %s' % VERSION_CHECKING_URL)
		return None

	if data[0] == '<':
		stderr('error accessing the file at %s' % VERSION_CHECKING_URL)
		return None

	data = string.strip(data)

	# format of the data in LATEST.txt is:
	# <version> <MD5 checksum>
	arr = string.split(data)
	if len(arr) != 2:
		return None
	
	return (arr[0], arr[1])
开发者ID:samuelet,项目名称:synctool,代码行数:27,代码来源:synctool_update.py


示例5: master_ping

def master_ping(rank, nodes):
	nodename = NODESET.get_nodename_from_interface(nodes[rank])
	if nodename == synctool_param.NODENAME:
		print '%s: up' % nodename
		return
	
	verbose('pinging %s' % nodename)
	unix_out('%s %s' % (synctool_param.PING_CMD, nodes[rank]))
开发者ID:gyepisam,项目名称:synctool,代码行数:8,代码来源:synctool_ping.py


示例6: master_pkg

def master_pkg(rank, args):
	# the master node only displays what we're running
	(nodes, ssh_cmd_arr, pkg_cmd_arr) = args
	
	node = nodes[rank]
	nodename = NODESET.get_nodename_from_interface(node)
	
	verbose('running synctool-pkg on node %s' % nodename)
	unix_out('%s %s %s' % (string.join(ssh_cmd_arr), node, string.join(pkg_cmd_arr)))
开发者ID:samuelet,项目名称:synctool,代码行数:9,代码来源:synctool_master_pkg.py


示例7: hard_delete_file

	def hard_delete_file(self):
		file = self.dest_path
		
		unix_out('rm -f %s' % file)
		
		if not synctool_lib.DRY_RUN:
			verbose('  os.unlink(%s)' % file)
			try:
				os.unlink(file)
			except OSError, reason:
				stderr('failed to delete %s : %s' % (file, reason))
开发者ID:gyepisam,项目名称:synctool,代码行数:11,代码来源:synctool_object.py


示例8: set_permissions

	def set_permissions(self):
		file = self.dest_path
		mode = self.src_statbuf.mode
		
		unix_out('chmod 0%o %s' % (mode & 07777, file))
		
		if not synctool_lib.DRY_RUN:
			verbose('  os.chmod(%s, %04o)' % (file, mode & 07777))
			try:
				os.chmod(file, mode & 07777)
			except OSError, reason:
				stderr('failed to chmod %04o %s : %s' % (mode & 07777, file, reason))
开发者ID:gyepisam,项目名称:synctool,代码行数:12,代码来源:synctool_object.py


示例9: set_owner

    def set_owner(self):
        file = self.dest_path
        uid = self.src_statbuf.uid
        gid = self.src_statbuf.gid

        unix_out("chown %s.%s %s" % (self.src_ascii_uid(), self.src_ascii_gid(), file))

        if not synctool_lib.DRY_RUN:
            verbose("  os.chown(%s, %d, %d)" % (file, uid, gid))
            try:
                os.chown(file, uid, gid)
            except OSError, reason:
                stderr("failed to chown %s.%s %s : %s" % (self.src_ascii_uid(), self.src_ascii_gid(), file, reason))
开发者ID:samuelet,项目名称:synctool,代码行数:13,代码来源:synctool_object.py


示例10: master_synctool

def master_synctool(rank, args):
	# the master node only displays what we're running
	(nodes, rsync_cmd_arr, ssh_cmd_arr, synctool_cmd_arr) = args
	
	node = nodes[rank]
	nodename = NODESET.get_nodename_from_interface(node)
	
	if rsync_cmd_arr != None:
		verbose('running rsync $masterdir/ to node %s' % nodename)
		unix_out('%s %s:%s/' % (string.join(rsync_cmd_arr), node, synctool_param.MASTERDIR))
	
	verbose('running synctool on node %s' % nodename)
	unix_out('%s %s %s' % (string.join(ssh_cmd_arr), node, string.join(synctool_cmd_arr)))
开发者ID:tevren,项目名称:synctool,代码行数:13,代码来源:synctool_master.py


示例11: mkdir_basepath

	def mkdir_basepath(self):
		'''call mkdir -p if the destination directory does not exist yet'''
		
		if synctool_lib.DRY_RUN:
			return
		
		# check if the directory exists
		basedir = os.path.dirname(self.dest_path)
		stat = synctool_stat.SyncStat(basedir)
		if not stat.exists():
			# create the directory
			verbose('making directory %s' % synctool_lib.prettypath(basedir))
			unix_out('mkdir -p %s' % basedir)
			synctool_lib.mkdir_p(basedir)
开发者ID:gyepisam,项目名称:synctool,代码行数:14,代码来源:synctool_object.py


示例12: copy_file

	def copy_file(self):
		self.mkdir_basepath()
		
		src = self.src_path
		dest = self.dest_path
		
		if self.dest_isFile():
			unix_out('cp %s %s.saved' % (dest, dest))
		
		unix_out('umask 077')
		unix_out('cp %s %s' % (src, dest))
		
		if not synctool_lib.DRY_RUN:
			old_umask = os.umask(077)
			
			if synctool_param.BACKUP_COPIES:
				if self.dest_isFile():
					verbose('  saving %s as %s.saved' % (dest, dest))
					try:
						shutil.copy2(dest, '%s.saved' % dest)
					except:
						stderr('failed to save %s as %s.saved' % (dest, dest))
			
			verbose('  cp %s %s' % (src, dest))
			try:
				shutil.copy2(src, dest)			# copy file and stats
			except:
				stderr('failed to copy %s to %s' % (self.print_src(), dest))
			
			os.umask(old_umask)
		else:
			if self.dest_isFile() and synctool_param.BACKUP_COPIES:
				verbose('  saving %s as %s.saved' % (dest, dest))
			
			verbose(dryrun_msg('  cp %s %s' % (src, dest)))
开发者ID:gyepisam,项目名称:synctool,代码行数:35,代码来源:synctool_object.py


示例13: master_ssh

def master_ssh(rank, args):
	(nodes, ssh_cmd_arr, remote_cmd_arr) = args
	
	node = nodes[rank]
	cmd_str = string.join(remote_cmd_arr)
	
	if node == synctool_param.NODENAME:
		verbose('running %s' % cmd_str)
		unix_out(cmd_str)
	else:
		verbose('running %s to %s %s' % (os.path.basename(ssh_cmd_arr[0]),
			NODESET.get_nodename_from_interface(node), cmd_str))
		
		unix_out('%s %s %s' % (string.join(ssh_cmd_arr), node, cmd_str))
开发者ID:gyepisam,项目名称:synctool,代码行数:14,代码来源:synctool_ssh.py


示例14: save_dir

	def save_dir(self):
		if not synctool_param.BACKUP_COPIES:
			return
		
		path = self.dest_path
		
		unix_out('mv %s %s.saved' % (path, path))
		
		if not synctool_lib.DRY_RUN:
			verbose('moving %s to %s.saved' % (path, path))
			try:
				os.rename(path, '%s.saved' % path)
			except OSError, reason:
				stderr('failed to move directory to %s.saved : %s' % (path, reason))
开发者ID:gyepisam,项目名称:synctool,代码行数:14,代码来源:synctool_object.py


示例15: erase_saved

	def erase_saved(self):
		dest = self.dest_path
		
		stat_saved_path = synctool_stat.SyncStat('%s.saved' % dest)
		
		if synctool_lib.ERASE_SAVED and stat_saved_path.exists() and not stat_saved_path.isDir():
			terse(synctool_lib.TERSE_DELETE, '%s.saved' % dest)
			unix_out('rm %s.saved' % dest)
			
			if synctool_lib.DRY_RUN:
				stdout(dryrun_msg('erase %s.saved' % dest, 'erase'))
			else:
				stdout('erase %s.saved' % dest)
				verbose('  os.unlink(%s.saved)' % dest)
				try:
					os.unlink('%s.saved' % dest)
				except OSError, reason:
					stderr('failed to delete %s : %s' % (dest, reason))
开发者ID:gyepisam,项目名称:synctool,代码行数:18,代码来源:synctool_object.py


示例16: make_dir

	def make_dir(self):
		self.mkdir_basepath()
		
		path = self.dest_path
		
		unix_out('umask 077')
		unix_out('mkdir %s' % path)
		
		if not synctool_lib.DRY_RUN:
			old_umask = os.umask(077)
			
			verbose('  os.mkdir(%s)' % path)
			try:
				os.mkdir(path)
			except OSError, reason:
				stderr('failed to make directory %s : %s' % (path, reason))
			
			os.umask(old_umask)
开发者ID:gyepisam,项目名称:synctool,代码行数:18,代码来源:synctool_object.py


示例17: delete_file

	def delete_file(self):
		file = self.dest_path
		
		if not synctool_lib.DRY_RUN:
			if synctool_param.BACKUP_COPIES:
				unix_out('mv %s %s.saved' % (file, file))
				
				verbose('moving %s to %s.saved' % (file, file))
				try:
					os.rename(file, '%s.saved' % file)
				except OSError, reason:
					stderr('failed to move file to %s.saved : %s' % (file, reason))
			else:
				unix_out('rm %s' % file)
				verbose('  os.unlink(%s)' % file)
				try:
					os.unlink(file)
				except OSError, reason:
					stderr('failed to delete %s : %s' % (file, reason))
开发者ID:gyepisam,项目名称:synctool,代码行数:19,代码来源:synctool_object.py


示例18: run_command_in_dir

def run_command_in_dir(dest_dir, cmd):
	'''change directory to dest_dir, and run the shell command'''
	
	verbose('  os.chdir(%s)' % dest_dir)
	unix_out('cd %s' % dest_dir)
	
	cwd = os.getcwd()
	
	# if dry run, the target directory may not exist yet (mkdir has not been called for real, for a dry run)
	if synctool_lib.DRY_RUN:
		run_command(cmd)
		
		verbose('  os.chdir(%s)' % cwd)
		unix_out('cd %s' % cwd)
		unix_out('')
		return
	
	try:
		os.chdir(dest_dir)
	except OSError, reason:
		stderr('error changing directory to %s: %s' % (dest_dir, reason))
开发者ID:gyepisam,项目名称:synctool,代码行数:21,代码来源:synctool.py


示例19: symlink_file

	def symlink_file(self, oldpath):
		self.mkdir_basepath()
		
		# note that old_path is the readlink() of the self.src_path
		newpath = self.dest_path
		
		if self.dest_exists():
			unix_out('mv %s %s.saved' % (newpath, newpath))
		
		#
		# actually, if we want the ownership of the symlink to be correct,
		# we should do setuid() here
		# matching ownerships of symbolic links is not yet implemented
		#
		
		# linux makes all symlinks mode 0777, but some other platforms do not
		umask_mode = synctool_param.SYMLINK_MODE ^ 0777
		
		unix_out('umask %03o' % umask_mode)
		unix_out('ln -s %s %s' % (oldpath, newpath))
		
		if not synctool_lib.DRY_RUN:
			if self.dest_exists():
				verbose('saving %s as %s.saved' % (newpath, newpath))
				try:
					os.rename(newpath, '%s.saved' % newpath)
				except OSError, reason:
					stderr('failed to save %s as %s.saved : %s' % (newpath, newpath, reason))
					terse(synctool_lib.TERSE_FAIL, 'save %s.saved' % newpath)
			
			old_umask = os.umask(umask_mode)
			
			verbose('  os.symlink(%s, %s)' % (oldpath, newpath))
			try:
				os.symlink(oldpath, newpath)
			except OSError, reason:
				stderr('failed to create symlink %s -> %s : %s' % (newpath, oldpath, reason))
				terse(synctool_lib.TERSE_FAIL, 'link %s' % newpath)
开发者ID:gyepisam,项目名称:synctool,代码行数:38,代码来源:synctool_object.py


示例20: master_scp

def master_scp(rank, args):
    (nodes, scp_cmd_arr, files_str) = args

    node = nodes[rank]
    nodename = NODESET.get_nodename_from_interface(node)

    # master thread only displays what we're running

    if DESTDIR:
        verbose("copying %s to %s:%s" % (files_str, nodename, DESTDIR))

        if SCP_OPTIONS:
            unix_out("%s %s %s %s:%s" % (synctool_param.SCP_CMD, SCP_OPTIONS, files_str, node, DESTDIR))
        else:
            unix_out("%s %s %s:%s" % (synctool_param.SCP_CMD, files_str, node, DESTDIR))

    else:
        verbose("copying %s to %s" % (files_str, nodename))

        if SCP_OPTIONS:
            unix_out("%s %s %s %s:" % (synctool_param.SCP_CMD, SCP_OPTIONS, files_str, node))
        else:
            unix_out("%s %s %s:" % (synctool_param.SCP_CMD, files_str, node))
开发者ID:samuelet,项目名称:synctool,代码行数:23,代码来源:synctool_scp.py



注:本文中的synctool_lib.verbose函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python synctool_pkgclass.SyncPkg类代码示例发布时间:2022-05-27
下一篇:
Python synctool_lib.stderr函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap