def deploy(source, destination, systemName=None, machineName=None): #TODO: Mugur: add comments and explain what is going one here. # THis should not be placed here a separate plugin needs to be created. assert isinstance(source, str), 'Invalid source path %s' % source assert isinstance(destination, str), 'Invalid destination path %s' % destination assert not systemName or isinstance(systemName, str), 'Invalid system name %s' % systemName assert not machineName or isinstance(machineName, str), 'Invalid machine name %s' % machineName systemName = systemName if systemName else system() machineName = machineName if machineName else machine() systems = {SYSTEM_ALL:True} if systemName == SYSTEM_ALL else {systemName:True, SYSTEM_ALL:False} machines = {MACHINE_ALL:True} if machineName == MACHINE_ALL else {machineName:True, MACHINE_ALL:False} for systemName, systemRequired in systems.items(): for machineName, machineRequired in machines.items(): srcDir = join(source, systemName, machineName) if not isdir(srcDir): try: getZipFilePath(srcDir) except IOError: if systemRequired and machineRequired: raise IOError('Cannot locate required dependency \'%s\' for system %s with architecture %s' % (srcDir, systemName, machineName)) else: continue synchronizeURIToDir(srcDir, destination)
def __init__(self): assert isinstance(self.command_transform, str), 'Invalid command transform %s' % self.command_transform assert isinstance(self.command_resize, str), 'Invalid command resize %s' % self.command_resize assert isinstance(self.avconv_dir_path, str), 'Invalid avconv directory %s' % self.avconv_dir_path assert isinstance(self.avconv_path, str), 'Invalid avconv path %s' % self.avconv_path if self.avconv_dir_path: synchronizeURIToDir(join(pythonPath(), 'resources', 'avconv'), self.avconv_dir_path)
def deploy(source, destination, systemName=None, machineName=None): ''' Deploys the tool found at the source directory to the destination directory. @param source: src The directory from which to deploy the tool @param destination: src The path where to deploy the tool @param systemName: src The name of the system for which to deploy (e.g. Darwin, Windows, Ubuntu) @param machineName: src The machine name (e.g.: x86, x86_64) @return: tuple Tuple containing the system information (name, release, version) and True if the tool was deployed, False if it wasn't ''' # TODO: This should not be placed here a separate plugin needs to be created. assert isinstance(source, str), 'Invalid source path %s' % source assert isinstance(destination, str), 'Invalid destination path %s' % destination assert not systemName or isinstance( systemName, str), 'Invalid system name %s' % systemName assert not machineName or isinstance( machineName, str), 'Invalid machine name %s' % machineName if not systemName: systemName, rel, ver = systemInfo() machineName = machineName if machineName else machine() systems = (SYSTEM_ALL) if systemName == SYSTEM_ALL else (systemName, SYSTEM_ALL) machines = (MACHINE_ALL) if machineName == MACHINE_ALL else (machineName, MACHINE_ALL) deployed = False for systemName in systems: for machineName in machines: srcDir = join(source, systemName, machineName) if not isdir(srcDir): try: zipPath, inPath = getZipFilePath(srcDir) validateInZipPath(ZipFile(zipPath), inPath + ZIPSEP) except (IOError, KeyError): continue synchronizeURIToDir(srcDir, destination) deployed = True return (systemName, rel, ver, deployed)
def deploy(source, destination, systemName=None, machineName=None): ''' Deploys the tool found at the source directory to the destination directory. @param source: src The directory from which to deploy the tool @param destination: src The path where to deploy the tool @param systemName: src The name of the system for which to deploy (e.g. Darwin, Windows, Ubuntu) @param machineName: src The machine name (e.g.: x86, x86_64) @return: tuple Tuple containing the system information (name, release, version) and True if the tool was deployed, False if it wasn't ''' # TODO: This should not be placed here a separate plugin needs to be created. assert isinstance(source, str), 'Invalid source path %s' % source assert isinstance(destination, str), 'Invalid destination path %s' % destination assert not systemName or isinstance(systemName, str), 'Invalid system name %s' % systemName assert not machineName or isinstance(machineName, str), 'Invalid machine name %s' % machineName if not systemName: systemName, rel, ver = systemInfo() machineName = machineName if machineName else machine() systems = (SYSTEM_ALL) if systemName == SYSTEM_ALL else (systemName, SYSTEM_ALL) machines = (MACHINE_ALL) if machineName == MACHINE_ALL else (machineName, MACHINE_ALL) deployed = False for systemName in systems: for machineName in machines: srcDir = join(source, systemName, machineName) if not isdir(srcDir): try: zipPath, inPath = getZipFilePath(srcDir) validateInZipPath(ZipFile(zipPath), inPath + ZIPSEP) except (IOError, KeyError): continue synchronizeURIToDir(srcDir, destination) deployed = True return (systemName, rel, ver, deployed)