Exemplo n.º 1
0
def run_post(src, dest):
	'''run any on_update or .post script commands for destination path'''
	
	global DIR_CHANGED
	
	stat = synctool_stat.SyncStat(dest)
	
	if stat.isDir():
		# directories will be handled later, so save this pair
		pair = (src, dest)
		DIR_CHANGED.append(pair)
		return
	
	dest_dir = os.path.dirname(dest)
	
	# file has changed, run on_update command
	if synctool_param.ON_UPDATE.has_key(dest):
		run_command_in_dir(dest_dir, synctool_param.ON_UPDATE[dest])
	
	# file has changed, run appropriate .post script
	postscript = synctool_overlay.postscript_for_path(src, dest)
	if postscript:
		run_command_in_dir(dest_dir, postscript)
	
	# content of directory was changed, so save this pair
	pair = (os.path.dirname(src), dest_dir)
	if not pair in DIR_CHANGED:
		DIR_CHANGED.append(pair)
Exemplo n.º 2
0
def run_post_on_directory(src, dest):
	'''run .post script for a changed directory'''
	
	# Note that the script is executed with the changed dir as current working dir
	
	if synctool_param.ON_UPDATE.has_key(dest):
		run_command_in_dir(dest, synctool_param.ON_UPDATE[dest])
	
	# run appropriate .post script
	postscript = synctool_overlay.postscript_for_path(src, dest)
	if postscript:
		run_command_in_dir(dest, postscript)