If you are using GitLab outside of the ILL, then you will need to use HTTPS and not SSH for clone/push/pull operations. SSH will work normally if you are using the VPN.

Commit 47847a26 authored by eric pellegrini's avatar eric pellegrini

Merge tag '1.0.3.e' into develop

version 1.0.3.e
parents f5289a42 b244f2c9
Pipeline #1171 passed with stages
in 10 minutes and 59 seconds
version 1.0.3.c:
version 1.0.3.e:
----------------
* bug fix relative to REGISTRY update
version 1.0.3.d:
----------------
* redirected the sys.stdout and sys.stderr to the LOGGER
* implemented a write method so as ConsoleHandler behaves as a file-like object
......@@ -16,7 +20,7 @@ version 1.0.3.c:
* removed unused imports
* removed white spaces
version 1.0.3.b:
version 1.0.3.c:
----------------
* bug fix with JobControllerPanel in case of crashing jobs
* regression fixed due to trials to get rid of relative imports MDANSE/Externals/pubsub package
......
......@@ -34,10 +34,24 @@ import glob
import imp
import inspect
import os
import sys
from MDANSE.Core.Singleton import Singleton
def path_to_module(path,stop=""):
path, _ = os.path.splitext(path)
splittedPath = path.split(os.sep)
try:
idx = splittedPath.index(stop)
except ValueError:
idx = 0
finally:
module = ".".join(splittedPath[idx:])
return module
class ClassRegistry(object):
'''
Metaclass that registers the classes that make the MDANSE framework.
......@@ -87,7 +101,7 @@ class ClassRegistry(object):
return self._registry.get(name,{})
def update(self,packageDir):
def update(self,packageDir, macros=False):
'''
Update the classes registry by importing all the modules contained in a given package.
......@@ -103,19 +117,21 @@ class ClassRegistry(object):
if moduleFile == '__init__.py':
continue
moduleName, _ = os.path.splitext(moduleFile)
# Any error that may occur here has to be caught. In such case the module is skipped.
try:
filehandler,path,description = imp.find_module(moduleName, [moduleDir])
mod = imp.load_module(moduleName,filehandler,path,description)
if macros:
moduleName,_ = os.path.splitext(moduleFile)
filehandler,path,description = imp.find_module(moduleName, [moduleDir])
imp.load_module(moduleName,filehandler,path,description)
filehandler.close()
else:
moduleName, _ = os.path.splitext(moduleFile)
module = path_to_module(module,stop="MDANSE")
__import__(module)
except:
continue
else:
if os.path.abspath(os.path.dirname(mod.__file__)) != os.path.abspath(moduleDir):
print "A module with name %s is already present in your distribution with %s path." % (moduleName,moduleDir)
def info(self, interface):
'''
Returns informations about the subclasses of a given base class stored in the registry.
......
......@@ -2,8 +2,8 @@ import os
from MDANSE import PLATFORM, REGISTRY
REGISTRY.update(os.path.join(os.path.dirname(__file__),"*"))
REGISTRY.update(os.path.join(os.path.dirname(__file__),"*"),False)
macrosDirectories = sorted([x[0] for x in os.walk(PLATFORM.macros_directory())][0:])
for d in macrosDirectories:
REGISTRY.update(d)
REGISTRY.update(d,True)
__version__ = "1.0.3.d"
__version__ = "1.0.3.e"
__date__ = "18-11-2016"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment