Commit d6faf156 authored by Betoule Marc's avatar Betoule Marc
Browse files

bug 747 segment library rescussitated

parent 81b5af8e
......@@ -192,16 +192,7 @@ class LocalRepository(Repository):
## string, where to find segment's source code file
self.src_path = src_path
## string, where to find segment's library
self.lib_path = None
if lib_path is None:
try:
self.lib_path = path.realpath(path.join(pipelet.inst.__path__[0],'../lib'))
except:
self.lib_path = None
#TODO log
pass
else:
self.lib_path = lib_path
self.lib_path = lib_path
def get_code_file(self, seg):
""" Return the filename of the segment code.
......@@ -224,9 +215,13 @@ class LocalRepository(Repository):
f = [filter(self._ext_filter,
glob(path.join(self.src_path, 'seg_%s_code.*'%seg)))[0]]
except:
#f = filter(self._ext_filter,
# glob(path.join(self.lib_path, 'seg_%s_code.*'%seg)))
f = []
if len(f) == 0:
try:
f = [filter(self._ext_filter,
glob(path.join(self.lib_path, 'seg_%s_code.*'%seg)))[0]]
except:
f = []
if len(f) == 0:
try:
s = re.findall('^(.+?)\d+$',seg)[0]
......@@ -258,8 +253,20 @@ class LocalRepository(Repository):
f = filter(self._ext_filter,
glob(path.join(self.src_path, 'seg_%s_%s.*'%(seg,hook))))[0]
except:
f = None
return f
f = []
if len(f) == 0:
try:
f = [filter(self._ext_filter,
glob(path.join(self.lib_path, 'seg_%s_%s.*'%(seg,hook))))[0]]
except:
f = []
if len(f) == 0:
try:
s = re.findall('^(.+?)\d+$',seg)[0]
f = [self.get_hook_file(s, hook)]
except:
raise Exception('No source file corresponding to hook')
return f[0]
......
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