Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
MDANSE
Commits
47847a26
Commit
47847a26
authored
Nov 18, 2016
by
eric pellegrini
Browse files
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
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
47847a26
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
* redirected the sys.stdout and sys.stderr to the LOGGER
* implemented a write method so as ConsoleHandler behaves as a file-like object
* implemented a write method so as ConsoleHandler behaves as a file-like object
...
@@ -16,7 +20,7 @@ version 1.0.3.c:
...
@@ -16,7 +20,7 @@ version 1.0.3.c:
* removed unused imports
* removed unused imports
* removed white spaces
* removed white spaces
version 1.0.3.
b
:
version 1.0.3.
c
:
----------------
----------------
* bug fix with JobControllerPanel in case of crashing jobs
* bug fix with JobControllerPanel in case of crashing jobs
* regression fixed due to trials to get rid of relative imports MDANSE/Externals/pubsub package
* regression fixed due to trials to get rid of relative imports MDANSE/Externals/pubsub package
...
...
MDANSE/Core/ClassRegistry.py
View file @
47847a26
...
@@ -34,10 +34,24 @@ import glob
...
@@ -34,10 +34,24 @@ import glob
import
imp
import
imp
import
inspect
import
inspect
import
os
import
os
import
sys
from
MDANSE.Core.Singleton
import
Singleton
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
):
class
ClassRegistry
(
object
):
'''
'''
Metaclass that registers the classes that make the MDANSE framework.
Metaclass that registers the classes that make the MDANSE framework.
...
@@ -87,7 +101,7 @@ class ClassRegistry(object):
...
@@ -87,7 +101,7 @@ class ClassRegistry(object):
return
self
.
_registry
.
get
(
name
,{})
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.
Update the classes registry by importing all the modules contained in a given package.
...
@@ -103,19 +117,21 @@ class ClassRegistry(object):
...
@@ -103,19 +117,21 @@ class ClassRegistry(object):
if
moduleFile
==
'__init__.py'
:
if
moduleFile
==
'__init__.py'
:
continue
continue
moduleName
,
_
=
os
.
path
.
splitext
(
moduleFile
)
# Any error that may occur here has to be caught. In such case the module is skipped.
# Any error that may occur here has to be caught. In such case the module is skipped.
try
:
try
:
filehandler
,
path
,
description
=
imp
.
find_module
(
moduleName
,
[
moduleDir
])
if
macros
:
mod
=
imp
.
load_module
(
moduleName
,
filehandler
,
path
,
description
)
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
:
except
:
continue
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
):
def
info
(
self
,
interface
):
'''
'''
Returns informations about the subclasses of a given base class stored in the registry.
Returns informations about the subclasses of a given base class stored in the registry.
...
...
MDANSE/Framework/__init__.py
View file @
47847a26
...
@@ -2,8 +2,8 @@ import os
...
@@ -2,8 +2,8 @@ import os
from
MDANSE
import
PLATFORM
,
REGISTRY
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
:])
macrosDirectories
=
sorted
([
x
[
0
]
for
x
in
os
.
walk
(
PLATFORM
.
macros_directory
())][
0
:])
for
d
in
macrosDirectories
:
for
d
in
macrosDirectories
:
REGISTRY
.
update
(
d
)
REGISTRY
.
update
(
d
,
True
)
MDANSE/__pkginfo__.py
View file @
47847a26
__version__
=
"1.0.3.
d
"
__version__
=
"1.0.3.
e
"
__date__
=
"18-11-2016"
__date__
=
"18-11-2016"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment