mirror of
https://github.com/yweber/lodel2.git
synced 2025-10-30 11:09:03 +01:00
Moved plugins folder in lodel/
- updated scripts etc - make tests pass
This commit is contained in:
parent
250f4b8683
commit
0406e91846
82 changed files with 28 additions and 8 deletions
|
|
@ -1,4 +1,4 @@
|
|||
SUBDIRS = lodel progs plugins lodelsites
|
||||
SUBDIRS = lodel progs lodelsites
|
||||
EXTRA_DIST = plugins runtest examples tests runtest.sh debian
|
||||
CLEANFILES = runtest
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ AC_CONFIG_FILES([Makefile \
|
|||
lodel/utils/Makefile \
|
||||
progs/Makefile \
|
||||
progs/slim/Makefile \
|
||||
plugins/Makefile \
|
||||
lodel/plugins/Makefile \
|
||||
lodelsites/Makefile \
|
||||
])
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
SUBDIRS=auth editorial_model leapi plugin settings utils
|
||||
SUBDIRS=auth editorial_model leapi plugin settings utils plugins
|
||||
|
||||
lodel_PYTHON = *.py
|
||||
CLEANFILES = buildconf.py
|
||||
|
|
|
|||
|
|
@ -38,6 +38,10 @@ class ContextError(Exception):
|
|||
class ContextModuleError(ContextError):
|
||||
pass
|
||||
|
||||
def dir_for_context(site_identifier):
|
||||
return os.path.join(lodelsites.__path__[0], site_identifier)
|
||||
|
||||
|
||||
##@brief Designed to permit dynamic packages creation from the lodel package
|
||||
#
|
||||
#The class is added in first position in the sys.metapath variable. Doing this
|
||||
|
|
@ -53,6 +57,9 @@ class ContextModuleError(ContextError):
|
|||
#@note Current implementation is far from perfection. In fact no deletion
|
||||
#mechanisms is written and the virtual package cannot be a subpackage of
|
||||
#the lodel package for the moment...
|
||||
#@note Current implementation asserts that all plugins are in CWD
|
||||
#a symlink will be done to create a copy of the plugins folder in
|
||||
#lodelsites/SITENAME/ folder
|
||||
class LodelMetaPathFinder(importlib.abc.MetaPathFinder):
|
||||
|
||||
def find_spec(fullname, path, target = None):
|
||||
|
|
@ -62,7 +69,7 @@ class LodelMetaPathFinder(importlib.abc.MetaPathFinder):
|
|||
spl = fullname.split('.')
|
||||
site_identifier = spl[1]
|
||||
#creating a symlink to represent the lodel site package
|
||||
mod_path = os.path.join(lodelsites.__path__[0], site_identifier)
|
||||
mod_path = dir_for_context(site_identifier)
|
||||
if not os.path.exists(mod_path):
|
||||
os.symlink(lodel.__path__[0], mod_path, True)
|
||||
#Cache invalidation after we "created" the new package
|
||||
|
|
@ -248,6 +255,14 @@ initialize it anymore")
|
|||
#Add a single context with no site_id
|
||||
cls._contexts = cls._current = cls(None)
|
||||
|
||||
##@brief Return the directory of the package of the current loaded context
|
||||
@classmethod
|
||||
def context_dir(cls):
|
||||
if cls._type == cls.MONOSITE:
|
||||
return './'
|
||||
return dir_for_context(cls._current.__id)
|
||||
|
||||
|
||||
##@brief Validate a context identifier
|
||||
#@param identifier str : the identifier to validate
|
||||
#@return true if the name is valide else false
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ ACTIVATE_METHOD_NAME = '_activate'
|
|||
##@brief Discover stage cache filename
|
||||
DISCOVER_CACHE_FILENAME = '.plugin_discover_cache.json'
|
||||
##@brief Default & failover value for plugins path list
|
||||
DEFAULT_PLUGINS_PATH_LIST = ['./plugins']
|
||||
DEFAULT_PLUGINS_PATH_LIST = [os.path.join(LodelContext.context_dir(),'plugins')]
|
||||
|
||||
##@brief List storing the mandatory variables expected in a plugin __init__.py
|
||||
#file
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ usage() {
|
|||
}
|
||||
|
||||
cp_loader() {
|
||||
cp -Rv $install_tpl/loader.py $instdir/
|
||||
loader="${install_tpl}/loader.py"
|
||||
cp -Rv $loader $instdir/
|
||||
# Adding lib path to loader
|
||||
sed -i -E "s#^(LODEL2_LIB_ABS_PATH = )None#\1'$libdir'#" "$loader"
|
||||
}
|
||||
|
|
@ -83,8 +84,12 @@ cp -Rv $install_tpl/conf.d $instdir/
|
|||
cp -Rv $em_file $instdir/editorial_model.pickle
|
||||
ln -sv $install_tpl/Makefile $instdir/Makefile
|
||||
ln -sv $install_tpl/lodel_admin.py $instdir/lodel_admin.py
|
||||
ln -sv $libdir/plugins $instdir/plugins
|
||||
ln -sv $libdir/lodel/plugins $instdir/plugins
|
||||
cp_loader
|
||||
|
||||
echo "BEGIN LS"
|
||||
ls -la $instdir
|
||||
echo "END LS"
|
||||
# Adding instance name to conf
|
||||
sed -i -E "s#^sitename = noname#sitename = $name#" "$conf"
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import sys, os, os.path
|
|||
#
|
||||
# Bootstraping
|
||||
#
|
||||
LODEL2_LIB_ABS_PATH = None
|
||||
LODEL2_LIB_ABS_PATH = '/home/yannweb/dev/lodel2/lodel2-git'
|
||||
if LODEL2_LIB_ABS_PATH is not None:
|
||||
if not os.path.isdir(LODEL2_LIB_ABS_PATH):
|
||||
print("FATAL ERROR : the LODEL2_LIB_ABS_PATH variable in loader.py is \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue