/usr/bin/pitivi is in pitivi 0.98-1.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | #! /usr/bin/python3
# -*- coding: utf-8 -*-
# Pitivi video editor
# 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
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
import os
import sys
import signal
import locale
import gettext
from ctypes import cdll
try:
x11 = cdll.LoadLibrary('libX11.so')
x11.XInitThreads()
except OSError:
pass
CONFIGURED_PYTHONPATH = ''
CONFIGURED_GI_TYPELIB_PATH = ''
CONFIGURED_LD_LIBRARY_PATH = '/usr/lib/x86_64-linux-gnu/libfakeroot:/usr/lib64/libfakeroot:/usr/lib32/libfakeroot:/usr/lib/libeatmydata'
CONFIGURED_GST_PLUGIN_PATH = ''
CONFIGURED_GST_PLUGIN_SYSTEM_PATH = ''
LIBDIR = '/usr/lib/x86_64-linux-gnu'
DATADIR = '/usr/share'
BUILDDIR = '/build/pitivi-ZgmVmQ/pitivi-0.98/deb-build'
def _prepend_env_path(name, value):
os.environ[name] = os.pathsep.join(value +
os.environ.get(name, "").split(os.pathsep))
def jump_through_hoops():
os.environ["JUMP_THROUGH_HOOPS"] = "1"
os.execv(sys.argv[0], sys.argv)
# Check if we're in development or installed version and set paths properly
def _in_devel():
return os.environ.get("PITIVI_DEVELOPMENT", "0") != "0"
def _add_pitivi_path():
dir = os.path.dirname(os.path.abspath(__file__))
if _in_devel():
root = os.path.split(dir)[0]
sys.path.append(BUILDDIR)
localedir = os.path.join(BUILDDIR, 'po')
else:
root = os.path.join(LIBDIR, 'pitivi', 'python')
localedir = os.path.join(DATADIR, "locale")
if root not in sys.path:
sys.path.append(root)
# prepend any directories found at configure time if they're not
# already in the path. (if they are already in the path, the user
# chose to have it that way, so we leave their order)
for path in CONFIGURED_PYTHONPATH.split(':'):
if not path:
continue
path = os.path.abspath(path)
if path not in sys.path:
sys.path.append(path)
# Added for i18n
try:
locale.setlocale(locale.LC_ALL, '')
locale.bindtextdomain('pitivi', localedir)
locale.textdomain('pitivi')
except Exception as e:
print("Couldn't set locale.", localedir, e)
try:
gettext.bindtextdomain('pitivi', localedir)
gettext.textdomain('pitivi')
except Exception as e:
print("Couldn't set the gettext domain. Translations will not work.", localedir, e)
if CONFIGURED_LD_LIBRARY_PATH or CONFIGURED_GST_PLUGIN_PATH:
_prepend_env_path("LD_LIBRARY_PATH", [CONFIGURED_LD_LIBRARY_PATH])
_prepend_env_path("GST_PLUGIN_PATH", [CONFIGURED_GST_PLUGIN_PATH])
if "JUMP_THROUGH_HOOPS" not in os.environ:
# ld caches LD_LIBRARY_PATH at startup so we need to execv() here. LALA.
jump_through_hoops()
if CONFIGURED_GST_PLUGIN_SYSTEM_PATH:
os.environ["GST_PLUGIN_SYSTEM_PATH"] = CONFIGURED_GST_PLUGIN_SYSTEM_PATH
if CONFIGURED_GI_TYPELIB_PATH:
_prepend_env_path("GI_TYPELIB_PATH", [CONFIGURED_GI_TYPELIB_PATH])
def _initialize_modules():
from pitivi.check import initialize_modules
try:
initialize_modules()
except Exception as e:
print("Failed to initialize modules")
raise
def _check_requirements():
from pitivi.check import check_requirements
if not check_requirements():
sys.exit(2)
def _run_pitivi():
from pitivi import application
signal.signal(signal.SIGINT, signal.SIG_DFL)
app = application.Pitivi()
app.run(sys.argv)
if __name__ == "__main__":
_add_pitivi_path()
_initialize_modules()
# Dep checks really have to happen here, not in application.py. Otherwise,
# as soon as application.py starts, it will try importing all the code and
# the classes in application.py will not even have the opportunity to run.
# We do these checks on every startup (even outside the dev environment, for
# soft deps); doing imports and gst registry checks has near-zero cost.
_check_requirements()
_run_pitivi()
|