Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
01d957c3
Commit
01d957c3
authored
15 years ago
by
Christian Goetze
Browse files
Options
Downloads
Patches
Plain Diff
Add retry logic on certain exit codes
parent
e20ac471
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/develop.py
+18
-14
18 additions, 14 deletions
indra/develop.py
with
18 additions
and
14 deletions
indra/develop.py
+
18
−
14
View file @
01d957c3
...
...
@@ -579,19 +579,23 @@ def get_build_cmd(self):
return
(
'"
%sdevenv.com
"
%s.sln /build %s
'
%
(
self
.
find_visual_studio
(),
self
.
project_name
,
self
.
build_type
))
def
run
(
self
,
command
,
name
=
None
):
def
run
(
self
,
command
,
name
=
None
,
retry_on
=
None
,
retries
=
1
):
'''
Run a program. If the program fails, raise an exception.
'''
ret
=
os
.
system
(
command
)
if
ret
:
if
name
is
None
:
name
=
command
.
split
(
None
,
1
)[
0
]
path
=
self
.
find_in_path
(
name
)
if
not
path
:
ret
=
'
was not found
'
else
:
ret
=
'
exited with status %d
'
%
ret
raise
CommandError
(
'
the command %r %s
'
%
(
name
,
ret
))
while
retries
:
retries
=
retries
-
1
ret
=
os
.
system
(
command
)
if
ret
:
if
name
is
None
:
name
=
command
.
split
(
None
,
1
)[
0
]
path
=
self
.
find_in_path
(
name
)
if
not
path
:
error
=
'
was not found
'
else
:
error
=
'
exited with status %d
'
%
ret
if
retry_on
is
not
None
and
retry_on
==
ret
:
print
"
Retrying... the command %r %s
"
%
(
name
,
error
))
else
:
raise
CommandError
(
'
the command %r %s
'
%
(
name
,
error
))
def
run_cmake
(
self
,
args
=
[]):
'''
Override to add the vstool.exe call after running cmake.
'''
...
...
@@ -629,11 +633,11 @@ def run_build(self, opts, targets):
for
t
in
targets
:
cmd
=
'
%s /project %s %s
'
%
(
build_cmd
,
t
,
'
'
.
join
(
opts
))
print
'
Running %r in %r
'
%
(
cmd
,
d
)
self
.
run
(
cmd
)
self
.
run
(
cmd
,
retry_on
=
4
,
retries
=
3
)
else
:
cmd
=
'
%s %s
'
%
(
build_cmd
,
'
'
.
join
(
opts
))
print
'
Running %r in %r
'
%
(
cmd
,
d
)
self
.
run
(
cmd
)
self
.
run
(
cmd
,
retry_on
=
4
,
retries
=
3
)
finally
:
os
.
chdir
(
cwd
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment