Skip to content

Commit

Permalink
add PYTHON_DIR to sys_path list & enforce root usage
Browse files Browse the repository at this point in the history
  • Loading branch information
bilelmoussaoui committed Aug 3, 2017
1 parent 559ea36 commit 5250d09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hardcode-tray.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ from argparse import ArgumentParser
from gettext import bindtextdomain, textdomain, gettext as _
from locale import bindtextdomain as locale_bindtextdomain
from locale import textdomain as locale_textdomain
from os import geteuid, environ
from os import geteuid
from sys import path as sys_path

from gi import require_version
require_version("Gtk", "3.0")
Expand All @@ -34,11 +35,15 @@ locale_bindtextdomain("@PACKAGE@", '@LOCALE_DIR@')
locale_textdomain("@PACKAGE@")
bindtextdomain("@PACKAGE@", '@LOCALE_DIR@')
textdomain("@PACKAGE@")
sys_path.insert(0, "@PYTHON_DIR@")

from HardcodeTray.app import App
from HardcodeTray.const import DESKTOP_ENV, ICONS_SIZE, THEMES_LIST
from HardcodeTray.enum import Action, ConversionTools

if geteuid() != 0:
print(_("You need to have root privileges to run the script."))
exit(_("Please try again, this time using 'sudo'. Exiting."))

parser = ArgumentParser(prog="@PACKAGE@")
parser.add_argument("--apply", "-a", action='store_true',
Expand Down
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ LOCALE_DIR = join_paths(get_option('prefix'), get_option('localedir'))
conf = configuration_data()
conf.set('DATA_DIR', DATA_DIR)
conf.set('LOCALE_DIR', LOCALE_DIR)
conf.set('PYTHON_DIR', PYTHON_DIR)
conf.set('PACKAGE', meson.project_name())
conf.set('VERSION', meson.project_version())

Expand Down

0 comments on commit 5250d09

Please sign in to comment.