PEATSA/Core/Environment.py
def _copyFileToDirectory(self, filename, directory, overwrite=False):
	
		'''For internal use only. Copies filename to directory.
		
		Note that since this is for internal use error checking is less vigourous.
		
		Parameters
			filename - A path to a file. Can be relative or absolute.
			If the path is relative its is resolved w.r.t the specified directory.
			directory - The directory to copy the file to.
			overwrite - If True, if a file exists in the directory with filename
				it is overwritten if possible. Otherwise that file is used.
				Default - False
		Returns:
			The full path to the copied file
			
		Exceptions:
			Raises an Exceptions.ArgumentError if the file does not exist.
			Raises an Excpetions.WorkingDirectoryError if the file could not be copied.'''
	
		#Only the root process does the copying
		destination = os.path.join(directory, os.path.split(filename)[1])
		self.environment.log('Copying %s to %s' % (filename, destination))
		if self.environment.isRoot():
			filename = self._checkFile(filename)
			
			#Check if the specified file to is in the working directory
			#If it is we don't do anything
			containingDirectory = os.path.split(filename)[0]
			if containingDirectory != directory:
				#Check if a copy of the file already is present
				#Again do nothing if this is so
				directoryContents = os.listdir(directory)
				if directoryContents.count(filename) is 1 and overwrite is True:
					#This automatically overwrites destination if it exists 
					#and the operation is possible
					shutil.copyfile(filename, destination)
				elif directoryContents.count(filename) is 0:
					shutil.copyfile(filename, destination)
		
		self.environment.wait()
		return destination
For internal use only. Copies filename to directory.
		
		Note that since this is for internal use error checking is less vigourous.
		
		Parameters
			filename - A path to a file. Can be relative or absolute.
			If the path is relative its is resolved w.r.t the specified directory.
			directory - The directory to copy the file to.
			overwrite - If True, if a file exists in the directory with filename
				it is overwritten if possible. Otherwise that file is used.
				Default - False
		Returns:
			The full path to the copied file
			
		Exceptions:
			Raises an Exceptions.ArgumentError if the file does not exist.
			Raises an Excpetions.WorkingDirectoryError if the file could not be copied.
For internal use only. Copies filename to directory.
Note that since this is for internal use error checking is less vigourous.

Parameters
filename - A path to a file. Can be relative or absolute.
If the path is relative its is resolved w.r.t the specified directory.
directory - The directory to copy the file to.
overwrite - If True, if a file exists in the directory with filename
it is overwritten if possible. Otherwise that file is used.
Default - False
Returns:
The full path to the copied file

Raises an Exceptions.ArgumentError if the file does not exist.
Raises an Excpetions.WorkingDirectoryError if the file could not be copied.
For internal use only . Copies filename to directory . Note that since this is for internal use error checking is less vigourous . Parameters filename - A path to a file . Can be relative or absolute . If the path is relative its is resolved w . r . t the specified directory . directory - The directory to copy the file to . overwrite - If True if a file exists in the directory with filename it is overwritten if possible . Otherwise that file is used . Default - False Returns : The full path to the copied file Raises an Exceptions . ArgumentError if the file does not exist . Raises an Excpetions . WorkingDirectoryError if the file could not be copied .
def _copyFileToDirectory(self, filename, directory, overwrite=False):
		destination = os.path.join(directory, os.path.split(filename)[1])
		self.environment.log('Copying %s to %s' % (filename, destination))
		if self.environment.isRoot():
			filename = self._checkFile(filename)
			containingDirectory = os.path.split(filename)[0]
			if containingDirectory != directory:
				directoryContents = os.listdir(directory)
				if directoryContents.count(filename) is 1 and overwrite is True:
					shutil.copyfile(filename, destination)
				elif directoryContents.count(filename) is 0:
					shutil.copyfile(filename, destination)
		self.environment.wait()
		return destination
def _copyFileToDirectory ( self , filename , directory , overwrite = False ) : destination = os . path . join ( directory , os . path . split ( filename ) [ 1 ] ) self . environment . log ( 'Copying %s to %s' % ( filename , destination ) ) if self . environment . isRoot ( ) : filename = self . _checkFile ( filename ) containingDirectory = os . path . split ( filename ) [ 0 ] if containingDirectory != directory : directoryContents = os . listdir ( directory ) if directoryContents . count ( filename ) is 1 and overwrite is True : shutil . copyfile ( filename , destination ) elif directoryContents . count ( filename ) is 0 : shutil . copyfile ( filename , destination ) self . environment . wait ( ) return destination
For internal use only.
For internal use only .
'''For internal use only. Copies filename to directory.
		
		Note that since this is for internal use error checking is less vigourous.
		
		Parameters
			filename - A path to a file. Can be relative or absolute.
			If the path is relative its is resolved w.r.t the specified directory.
			directory - The directory to copy the file to.
			overwrite - If True, if a file exists in the directory with filename
				it is overwritten if possible. Otherwise that file is used.
				Default - False
		Returns:
			The full path to the copied file
			
		Exceptions:
			Raises an Exceptions.ArgumentError if the file does not exist.
			Raises an Excpetions.WorkingDirectoryError if the file could not be copied.''' #Only the root process does the copying #Check if the specified file to is in the working directory #If it is we don't do anything #Check if a copy of the file already is present #Again do nothing if this is so #This automatically overwrites destination if it exists  #and the operation is possible
self
filename
directory
overwrite