From faaa3d5b2cd0339549baf91ae2d4c4d41644695e Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Thu, 27 Oct 2011 22:05:27 +0200 Subject: [PATCH] [entropy.const] drop etpConst['triggersdir'] global variable --- lib/entropy/const.py | 4 +--- .../plugins/interfaces/portage_plugin/__init__.py | 3 ++- lib/entropy/spm/plugins/skel.py | 12 +++++++++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/entropy/const.py b/lib/entropy/const.py index c47463195..b3e24611c 100644 --- a/lib/entropy/const.py +++ b/lib/entropy/const.py @@ -190,7 +190,6 @@ def const_default_settings(rootdir): default_etp_dbfile = "packages.db" default_etp_dbclientfile = "equo.db" default_etp_client_repodir = "/client" - default_etp_triggersdir = "/triggers/"+ETP_ARCH_CONST default_etp_smartappsdir = "/smartapps/"+ETP_ARCH_CONST default_etp_smartpackagesdir = "/smartpackages/"+ETP_ARCH_CONST default_etp_cachesdir = "/caches/" @@ -223,8 +222,7 @@ def const_default_settings(rootdir): # etpConst['smartpackagesdir'] location where # smart packages files are places 'smartpackagesdir': default_etp_dir+default_etp_smartpackagesdir, - # etpConst['triggersdir'] location where external triggers are placed - 'triggersdir': default_etp_dir+default_etp_triggersdir, + # directory where entropy stores its configuration 'confdir': default_etp_confdir, # same as above + /packages diff --git a/lib/entropy/spm/plugins/interfaces/portage_plugin/__init__.py b/lib/entropy/spm/plugins/interfaces/portage_plugin/__init__.py index 1c093d544..cde00cfe5 100644 --- a/lib/entropy/spm/plugins/interfaces/portage_plugin/__init__.py +++ b/lib/entropy/spm/plugins/interfaces/portage_plugin/__init__.py @@ -1173,7 +1173,8 @@ class PortagePlugin(SpmPlugin): ebuild_path) data['trigger'] = const_convert_to_rawstring("") - trigger_file = os.path.join(etpConst['triggersdir'], data['category'], + triggers_dir = SpmPlugin.external_triggers_dir() + trigger_file = os.path.join(triggers_dir, data['category'], data['name'], etpConst['triggername']) if os.access(trigger_file, os.R_OK) and os.path.isfile(trigger_file): with open(trigger_file, "rb") as trig_f: diff --git a/lib/entropy/spm/plugins/skel.py b/lib/entropy/spm/plugins/skel.py index e40dd2cd2..d4bdf0497 100644 --- a/lib/entropy/spm/plugins/skel.py +++ b/lib/entropy/spm/plugins/skel.py @@ -12,7 +12,7 @@ """ import os -from entropy.const import etpConst +from entropy.const import etpConst, etpSys from entropy.core import Singleton from entropy.misc import LogFile from entropy.core.settings.base import SystemSettings @@ -52,6 +52,16 @@ class SpmPlugin(Singleton): """ raise NotImplementedError() + @staticmethod + def external_triggers_dir(): + """ + External Entropy triggers executable directory + This path should be used by SPM to read the trigger for + packages inside extract_package_metadata() + """ + return os.path.join( + etpConst['entropyworkdir'], "triggers", etpSys['arch']) + @staticmethod def get_package_groups(): """