Logo Search packages:      
Sourcecode: xdiagnose version File versions  Download package

xdiagnoseconfig.py

# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright (C) 2010 Bryce Harrington bryce@canonical.com
# This program is free software: you can redistribute it and/or modify it 
# under the terms of the GNU General Public License version 3, as published 
# by the Free Software Foundation.
# 
# This program is distributed in the hope that it will be useful, but 
# WITHOUT ANY WARRANTY; without even the implied warranties of 
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
# PURPOSE.  See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along 
# with this program.  If not, see <http://www.gnu.org/licenses/>.

__all__ = [
    'project_path_not_found',
    'get_data_file',
    'get_data_path',
    ]

import os

import gettext
from gettext import gettext as _
gettext.textdomain('xdiagnose')

00027 class project_path_not_found(Exception):
    """Raised when we can't find the project directory."""


def get_data_path():
    """Retrieve xdiagnose data path

    This path is by default <xdiagnose_lib_path>/../data/ in trunk
    and /usr/share/xdiagnose in an installed version but this path
    is specified at installation time.
    """

    # Get pathname absolute or relative.
    path = os.path.join(
        os.path.dirname(__file__), __xdiagnose_data_directory__)

    abs_data_path = os.path.abspath(path)
    if not os.path.exists(abs_data_path):
        raise project_path_not_found

    return abs_data_path

Generated by  Doxygen 1.6.0   Back to index