Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
external_updater
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test-restored
platform
tools
external_updater
Commits
b0bae9ac
Commit
b0bae9ac
authored
7 years ago
by
Elliott Hughes
Committed by
android-build-merger
7 years ago
Browse files
Options
Downloads
Plain Diff
Distinguish more clearly between the three states. am:
3f73a459
am:
08985a7a
am:
cfe0192f
Change-Id: I61e02bd3c734bf79279baa203bb4ae1f36ec5d1b
parents
ede28889
cfe0192f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
external_updater.py
+10
-10
10 additions, 10 deletions
external_updater.py
with
10 additions
and
10 deletions
external_updater.py
+
10
−
10
View file @
b0bae9ac
...
...
@@ -36,8 +36,9 @@ UPDATERS = [GithubArchiveUpdater, GitUpdater]
def
color_string
(
string
,
color
):
"""
Changes the color of a string when print to terminal.
"""
colors
=
{
'
SUCCESS
'
:
'
\x1b
[92m
'
,
'
FAILED
'
:
'
\x1b
[91m
'
,
'
FRESH
'
:
'
\x1b
[32m
'
,
'
STALE
'
:
'
\x1b
[31;1m
'
,
'
ERROR
'
:
'
\x1b
[31m
'
,
}
end_color
=
'
\033
[0m
'
return
colors
[
color
]
+
string
+
end_color
...
...
@@ -59,14 +60,14 @@ def build_updater(proj_path):
try
:
metadata
=
fileutils
.
read_metadata
(
proj_path
)
except
text_format
.
ParseError
as
err
:
print
(
'
{} {}.
'
.
format
(
color_string
(
'
Invalid metadata file:
'
,
'
FAILED
'
),
print
(
'
{} {}.
'
.
format
(
color_string
(
'
Invalid metadata file:
'
,
'
ERROR
'
),
err
))
return
None
try
:
updater
=
updater_utils
.
create_updater
(
metadata
,
proj_path
,
UPDATERS
)
except
ValueError
:
print
(
color_string
(
'
No supported URL.
'
,
'
FAILED
'
))
print
(
color_string
(
'
No supported URL.
'
,
'
ERROR
'
))
return
None
return
updater
...
...
@@ -79,8 +80,7 @@ def check_update(proj_path):
"""
print
(
'
{} {}.
'
.
format
(
color_string
(
'
Checking
'
,
'
SUCCESS
'
),
fileutils
.
get_relative_project_path
(
proj_path
)),
'
Checking {}.
'
.
format
(
fileutils
.
get_relative_project_path
(
proj_path
)),
end
=
''
)
updater
=
build_updater
(
proj_path
)
if
updater
is
None
:
...
...
@@ -88,12 +88,12 @@ def check_update(proj_path):
try
:
new_version
=
updater
.
check
()
if
new_version
:
print
(
color_string
(
'
New version found.
'
,
'
SUCCESS
'
))
print
(
color_string
(
'
Out of date!
'
,
'
STALE
'
))
else
:
print
(
'
No new version.
'
)
print
(
color_string
(
'
Up to date.
'
,
'
FRESH
'
)
)
return
(
updater
,
new_version
)
except
IOError
as
err
:
print
(
'
{} {}.
'
.
format
(
color_string
(
'
Failed.
'
,
'
FAILED
'
),
print
(
'
{} {}.
'
.
format
(
color_string
(
'
Failed.
'
,
'
ERROR
'
),
err
))
return
(
None
,
None
)
except
subprocess
.
CalledProcessError
as
err
:
...
...
@@ -101,7 +101,7 @@ def check_update(proj_path):
'
{} {}
\n
stdout: {}
\n
stderr: {}.
'
.
format
(
color_string
(
'
Failed.
'
,
'
FAILED
'
),
'
ERROR
'
),
err
,
err
.
stdout
,
err
.
stderr
))
...
...
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