1# -*- coding: utf-8 -*-
2# Pitivi video editor
3# Copyright (c) 2005, Edward Hervey <bilboed@bilboed.com>
4#
5# This program is free software; you can redistribute it and/or
6# modify it under the terms of the GNU Lesser General Public
7# License as published by the Free Software Foundation; either
8# version 2.1 of the License, or (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13# Lesser General Public License for more details.
14#
15# You should have received a copy of the GNU Lesser General Public
16# License along with this program; if not, see <http://www.gnu.org/licenses/>.
17"""
18Utilities for getting the location of various directories.
19Enables identical use for installed and uninstalled versions.
20"""
21import os.path
22
23LIBDIR = os.path.realpath('../lib/pitivi')
24WIN32_LIBDIR = '..\\..\\..\\..\\lib\\pitivi\\'
25PKGDATADIR = os.path.realpath('../share/pitivi')
26PIXMAPDIR = os.path.realpath('../share/pitivi/pixmaps')
27pitivi_version = '0.13.4'
28APPNAME = 'pitivi'
29PYGTK_REQ = '2.12'
30PYGST_REQ = '0.10'
31GST_REQ = '0.10.22'
32GNONLIN_REQ = '0.10.12'
33PYCAIRO_REQ = '1.8'
34
35
36def _get_root_dir():
37    return '/'.join(os.path.dirname(os.path.abspath(__file__)).split('/')[:-1])
38
39
40def _in_devel():
41    rd = _get_root_dir()
42    return (os.path.exists(os.path.join(rd, '.svn')) or
43            os.path.exists(os.path.join(rd, 'CVS')) or
44            os.path.exists(os.path.join(rd, '.git')))
45
46
47def get_pixmap_dir():
48    """ Returns the directory for program-only pixmaps """
49    _dir = os.path.dirname(os.path.abspath(__file__))
50    if _in_devel():
51        root = _dir
52    else:
53        root = PKGDATADIR
54    print(os.path.join(root, 'pixmaps'))
55    return os.path.join(root, 'pixmaps')
56
57
58def get_global_pixmap_dir():
59    """ Returns the directory for global pixmaps (ex : application icon) """
60    if _in_devel():
61        root = _get_root_dir()
62    else:
63        root = PIXMAPDIR
64    return root
65