Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
pipelet
Pipelet
Commits
f09dca85
Commit
f09dca85
authored
Jan 27, 2011
by
Betoule Marc
Browse files
correct bugs in the hooking system introduced when working on Task #1263
parent
5e733fab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
pipelet/repository.py
pipelet/repository.py
+20
-5
No files found.
pipelet/repository.py
View file @
f09dca85
...
...
@@ -21,6 +21,15 @@ import re
import
logging
from
directive
import
Depend
logger
=
logging
.
getLogger
(
'scheduler'
)
class
RepositoryError
(
Exception
):
""" To avoid catching Exception
"""
def
__init__
(
self
,
value
):
self
.
parameter
=
value
def
__str__
(
self
):
return
repr
(
self
.
parameter
)
class
Repository
:
""" Location of the segment's source code.
...
...
@@ -68,10 +77,10 @@ class Repository:
for
s
in
range
(
len
(
seg
)):
for
h
in
range
(
len
(
hook
)):
def
match
(
x
):
return
path
.
basename
(
x
)
==
seg
[
0
:
len
(
seg
)
-
s
]
+
'_'
+
hook
[
0
:
len
(
hook
)
-
h
]
+
'.py'
fn
=
filter
(
match
,
fns
)
[
0
]
fn
=
filter
(
match
,
fns
)
if
len
(
fn
)
>
0
:
return
fn
[
0
]
raise
Exception
(
'No source file corresponding to segment %s and hook %s'
%
(
seg
,
hook
))
raise
RepositoryError
(
'No source file corresponding to segment %s and hook %s'
%
(
seg
,
hook
))
def
_fill_dict
(
self
,
lstseg
):
""" Initialize all dictionnaries.
...
...
@@ -90,10 +99,16 @@ class Repository:
## hooks
lsthook
=
self
.
get_hook_list
(
source
)
self
.
_hook
[
s
]
=
{}
for
h
in
lsthook
:
fn
=
self
.
_match_fn
(
fns
,
s
,
h
)
source
=
self
.
get_code_source
(
fn
)
self
.
_hook
[
s
][
h
]
=
compile
(
so
,
fn
,
"exec"
)
try
:
fn
=
self
.
_match_fn
(
fns
,
s
,
h
)
source
=
self
.
get_code_source
(
fn
)
except
RepositoryError
,
e
:
# No source file
logger
.
warning
(
repr
(
e
))
source
=
""
fn
=
""
self
.
_hook
[
s
][
h
]
=
compile
(
source
,
fn
,
"exec"
)
self
.
_all_string
[
s
]
+=
source
## deps
...
...
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