configure.py.in 3.04 KB
Newer Older
1
# -*- coding: utf-8 -*-
2
# Pitivi video editor
3 4 5 6 7 8 9 10 11 12 13 14 15 16
# Copyright (c) 2005, Edward Hervey <bilboed@bilboed.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the
Hicham HAOUARI's avatar
Hicham HAOUARI committed
17 18
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
19 20
"""Utilities for getting the location of various directories.

Edward Hervey's avatar
Edward Hervey committed
21 22
Enables identical use for installed and uninstalled versions.
"""
23 24

import os.path
25
from gi.repository import GLib
26

27

28
# Again, mostly the same thing as in bin/pitivi.in and pitivi/utils/misc.py:
29 30 31
def _get_root_dir():
    return '/'.join(os.path.dirname(os.path.abspath(__file__)).split('/')[:-1])

32

33
def in_devel():
34
    """Returns whether the app is run from a git checkout."""
Dmitrii Petukhov's avatar
Dmitrii Petukhov committed
35
    return os.environ.get("PITIVI_DEVELOPMENT", "0") != "0"
36

37 38
LIBDIR = '@LIBDIR@'
PKGDATADIR = '@DATADIR@/@PACKAGE@'
39
GITVERSION = '@GITVERSION@'
40
VERSION = '@VERSION@'
41
APPNAME = '@PACKAGE_NAME@'
42
APPURL = 'http://www.pitivi.org/'
Paul Lange's avatar
Paul Lange committed
43
RELEASES_URL = 'http://pitivi.org/releases.txt'
44
APPMANUALURL_ONLINE = 'http://www.pitivi.org/manual'
45
BUILDDIR = '@BUILDDIR@'
46

47

48
if in_devel():
49 50
    APPMANUALURL_OFFLINE = 'ghelp://%s' % os.path.join(_get_root_dir(), 'help/C')
else:
51
    APPMANUALURL_OFFLINE = 'help:pitivi'
52

53

54
def get_data_dir():
55
    if in_devel():
56
        datadir = os.path.join(_get_root_dir(), "data")
57 58
    elif os.getenv("PITIVI_TOP_LEVEL_DIR"):
        top_level = os.getenv("PITIVI_TOP_LEVEL_DIR")
59
        datadir = os.path.join(top_level, "data")
60
    else:
61 62
        datadir = PKGDATADIR
    return os.path.abspath(datadir)
63

64

65
def get_pixmap_dir():
66
    """Returns our directory with pixmaps."""
67 68
    return os.path.join(get_data_dir(), 'pixmaps')

69

70
def get_ui_dir():
71
    """Returns our directory with Gtk.Builder/Glade files."""
72
    return os.path.join(get_data_dir(), 'ui')
Feroze Naina's avatar
Feroze Naina committed
73

74

75
def get_audiopresets_dir():
76
    """Returns our directory with Audio Presets files."""
77 78
    return os.path.join(get_data_dir(), 'audiopresets')

79

80
def get_videopresets_dir():
81
    """Returns our directory with Video Presets files."""
82
    return os.path.join(get_data_dir(), 'videopresets')
83 84

def get_gstpresets_dir():
85
    """Returns our directory with Gst Presets files."""
86
    return os.path.join(get_data_dir(), 'gstpresets')
87 88 89 90 91 92 93 94 95

def get_plugins_dir():
    """Returns our default directory to store official plugins."""
    return os.path.join(_get_root_dir(), 'plugins')

def get_user_plugins_dir():
    """Returns our default directory to store non-official plugins."""
    user_data_dir = GLib.get_user_data_dir()
    return os.path.join(user_data_dir, 'pitivi', 'plugins')