def from_file(cls, filename): """Reads a project from a project file.""" inifile = IniFile(filename) if inifile.is_new: return None name = (inifile.get("project.name") or os.path.basename(filename).rsplit(".")[0].title()) path = os.path.join( os.path.dirname(filename), untrusted_to_os_path(inifile.get("project.path") or "."), ) themes = inifile.get("project.themes") if themes is not None: themes = [x.strip() for x in themes.split(",")] else: themes = [] return cls( name=name, project_file=filename, tree=path, themes=themes, )
def from_file(cls, filename): """Reads a project from a project file.""" inifile = IniFile(filename) if inifile.is_new: return None name = inifile.get('project.name') or os.path.basename( filename).rsplit('.')[0].title() path = os.path.join(os.path.dirname(filename), untrusted_to_os_path( inifile.get('project.path') or '.')) return cls( name=name, project_file=filename, tree=path, )
def from_file(cls, filename): """Reads a project from a project file.""" inifile = IniFile(filename) if inifile.is_new: return None name = inifile.get('project.name') or os.path.basename( filename).rsplit('.')[0].title() path = os.path.join(os.path.dirname(filename), untrusted_to_os_path( inifile.get('project.path') or '.')) themes = inifile.get('project.themes') if themes is not None: themes = [x.strip() for x in themes.split(',')] else: themes = [] return cls( name=name, project_file=filename, tree=path, themes=themes, )