def validate_program(self, programs): # First we try to find the program in the local path program_paths = [which(program) for program in programs] program_paths = [path for path in program_paths if path is not None] print programs print program_paths if program_paths: return program_paths[0] elif self.setup is None: msg = 'No program from the set "%s" found in PATH and no SMRT Analysis supplied' % str( programs) log.error(msg) raise IOError(msg) # Fallback to the Setup Script if needed setup_programs = [ os.path.join(self.setup, 'analysis/bin', p) for p in programs ] setup_programs = [validate_file(p) for p in setup_programs] setup_programs = [path for path in setup_programs if path is not None] if setup_programs: return setup_programs[0] else: msg = 'No program from the set "%s" found in either PATH or SMRT Analysis env' % str( programs) log.error(msg) raise IOError(msg)
def test_setup(self): """Determine whether we need a setup script, and which environment to use""" if self.setup and which(self.exe): # TODO: Add validation that the setup script works log.info('"%s" not detected, using supplied environment' % self.name) return True elif self.setup and which(self.exe) is None: log.info('%s detected, but using supplied environment instead.' % self.name + \ 'Do not pass a "setup" argument to use local environment') return True elif self.setup is None and which(self.exe): log.info('"%s" detected, using local environment' % self.name) return False else: msg = '"%s" requires EITHER a valid executable in the local ' % self.name + \ 'path OR a virtualenv setup script' log.error( msg ) raise Exception( msg )
def test_setup(self): """Determine whether we need a setup script, and which environment to use""" if self.setup and which(self.exe): # TODO: Add validation that the setup script works log.info('"%s" not detected, using supplied environment' % self.name) return True elif self.setup and which(self.exe) is None: log.info('%s detected, but using supplied environment instead.' % self.name + \ 'Do not pass a "setup" argument to use local environment') return True elif self.setup is None and which(self.exe): log.info('"%s" detected, using local environment' % self.name) return False else: msg = '"%s" requires EITHER a valid executable in the local ' % self.name + \ 'path OR a virtualenv setup script' log.error(msg) raise Exception(msg)
def validate_program(self, programs): # First we try to find the program in the local path program_paths = [which(program) for program in programs] program_paths = [path for path in program_paths if path is not None] print programs print program_paths if program_paths: return program_paths[0] elif self.setup is None: msg = 'No program from the set "%s" found in PATH and no SMRT Analysis supplied' % str(programs) log.error(msg) raise IOError(msg) # Fallback to the Setup Script if needed setup_programs = [os.path.join(self.setup, "analysis/bin", p) for p in programs] setup_programs = [validate_file(p) for p in setup_programs] setup_programs = [path for path in setup_programs if path is not None] if setup_programs: return setup_programs[0] else: msg = 'No program from the set "%s" found in either PATH or SMRT Analysis env' % str(programs) log.error(msg) raise IOError(msg)