summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/__init__.py10
-rw-r--r--portato/constants.py17
2 files changed, 20 insertions, 7 deletions
diff --git a/portato/__init__.py b/portato/__init__.py
index ed5c94b..b4ea214 100644
--- a/portato/__init__.py
+++ b/portato/__init__.py
@@ -17,7 +17,7 @@ import sys, os
from optparse import OptionParser, SUPPRESS_HELP
from .log import start as logstart
-from .constants import LOCALE_DIR, APP, VERSION, REVISION
+from .constants import LOCALE_DIR, APP, VERSION, REVISION, PLUGIN_DIR
from .helper import debug, info, error
# set better version info
@@ -53,6 +53,9 @@ def get_parser (use_ = False):
parser.add_option("-F", "--no-fork", action = "store_true", dest = "nofork", default = False,
help = _("do not fork off as root"))
+ parser.add_option("--plugin-dir", action = "store_true", dest = "pdir", default = False,
+ help = _("print the directory the plugins are located in"))
+
return parser
def _sub_start ():
@@ -71,6 +74,11 @@ def start():
# run parser
(options, args) = get_parser().parse_args()
+ # plugin dir
+ if options.pdir:
+ print PLUGIN_DIR
+ return
+
if options.nofork or os.getuid() == 0: # start GUI
# close listener at exit
diff --git a/portato/constants.py b/portato/constants.py
index 059017e..5faefe1 100644
--- a/portato/constants.py
+++ b/portato/constants.py
@@ -26,13 +26,16 @@ These should be set during the installation.
@var CONFIG_LOCATION: L{CONFIG_DIR} plus name of the config file.
@type CONFIG_LOCATION: string
+@var ROOT_DIR: Overall root -- normally just '/'.
+@type ROOT_DIR: string
+@var DATA_DIR: Directory which contains all shared files.
+@type DATA_DIR: string
+
@var ICON_DIR: directory containing the icons
@type ICON_DIR: string
@var APP_ICON: the path of the application icon
@type APP_ICON: string
-@var DATA_DIR: Directory which contains all shared files.
-@type DATA_DIR: string
@var LOCALE_DIR: the path to the directory where the locale files (*.mo) are stored.
@type LOCALE_DIR: string
@var PLUGIN_DIR: Directory containing the plugin xmls.
@@ -54,8 +57,11 @@ from os.path import join as pjoin
if os.getuid() == 0:
os.environ["HOME"] = "/root"
+ROOT_DIR = ""
+DATA_DIR = "./"
+
# icons
-ICON_DIR = "icons/"
+ICON_DIR = pjoin(ROOT_DIR, DATA_DIR, "icons/")
APP_ICON = pjoin(ICON_DIR, "portato-icon.png")
# general
@@ -64,14 +70,13 @@ VERSION = "9999"
HOME = os.environ["HOME"]
# config
-CONFIG_DIR = "etc/"
+CONFIG_DIR = pjoin(ROOT_DIR, "etc/")
CONFIG_LOCATION = pjoin(CONFIG_DIR, "portato.cfg")
SESSION_DIR = pjoin(os.environ["HOME"], ".portato")
# misc dirs
-DATA_DIR = "./"
LOCALE_DIR = "i18n/"
-PLUGIN_DIR = pjoin(DATA_DIR, "plugins/")
+PLUGIN_DIR = pjoin(ROOT_DIR, DATA_DIR, "plugins/")
SETTINGS_DIR = pjoin(HOME, "."+APP)
TEMPLATE_DIR = "portato/gui/templates/"