def validate(self): """Should be called before processing""" # Just path validation for now. util.check_folder_exists(self.base_path) self.alignment_path = os.path.join(self.base_path, self.alignment) log.info("Looking for alignment file '%s'...", self.alignment_path) util.check_file_exists(self.alignment_path) if self.user_tree is None: self.user_tree_topology_path = None else: self.user_tree_topology_path = os.path.join(self.base_path, self.user_tree) log.info("Looking for tree file '%s'...", self.user_tree_topology_path) util.check_file_exists(self.user_tree_topology_path)
def validate(self): """Should be called before processing""" # Just path validation for now. util.check_folder_exists(self.base_path) self.alignment_path = os.path.join(self.base_path, self.alignment) log.info("Looking for alignment file '%s'...", self.alignment_path) util.check_file_exists(self.alignment_path) if self.user_tree is None: self.user_tree_topology_path = None else: self.user_tree_topology_path = \ os.path.join(self.base_path, self.user_tree) log.info("Looking for tree file '{}'...".format( self.user_tree_topology_path)) util.check_file_exists(self.user_tree_topology_path)
def find_config_file(self, pth): """Try and get the base folder and config file from the path""" if os.path.isfile(pth): # Is it a config file pth, ext = os.path.splitext(pth) folder, filename = os.path.split(pth) filename += ext if ext == ".cfg": return folder, filename # We still need a filename else: folder = pth util.check_folder_exists(folder) # Now let's find the filename. Just return the first hit. for filename in os.listdir(folder): if fnmatch.fnmatch(filename, "*.cfg"): return folder, filename log.error("Cannot find a configuration file in " "working folder '%s'", folder) raise ConfigurationError
def find_config_file(self, pth): """Try and get the base folder and config file from the path""" if os.path.isfile(pth): # Is it a config file pth, ext = os.path.splitext(pth) folder, filename = os.path.split(pth) filename += ext if ext == '.cfg': return folder, filename # We still need a filename else: folder = pth util.check_folder_exists(folder) # Now let's find the filename. Just return the first hit. for filename in os.listdir(folder): if fnmatch.fnmatch(filename, '*.cfg'): return folder, filename log.error("Cannot find a configuration file in " "working folder '%s'", folder) raise ConfigurationError