Exemplo n.º 1
0
def project_from_file(filename):
    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),
                        to_os_path(inifile.get('project.path') or '.'))
    return Project(
        name=name,
        project_file=filename,
        tree=path,
    )
Exemplo n.º 2
0
    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),
                            to_os_path(inifile.get('project.path') or '.'))
        return cls(
            name=name,
            project_file=filename,
            tree=path,
        )
Exemplo n.º 3
0
 def to_fs_path(self, path):
     """Convenience function to convert a path into an file system path."""
     return os.path.join(self.env.root_path, 'content', to_os_path(path))