Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
Hdlmake
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
15
Issues
15
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Hdlmake
Commits
f456fda5
Commit
f456fda5
authored
Aug 17, 2016
by
Javier D. Garcia-Lasheras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up some fetch related methods
parent
3915253c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
47 deletions
+41
-47
action.py
hdlmake/action/action.py
+2
-46
core.py
hdlmake/action/core.py
+39
-1
No files found.
hdlmake/action/action.py
View file @
f456fda5
...
@@ -76,7 +76,8 @@ class Action(list):
...
@@ -76,7 +76,8 @@ class Action(list):
def
check_all_fetched_or_quit
(
self
):
def
check_all_fetched_or_quit
(
self
):
"""Check if every module in the pool is fetched"""
"""Check if every module in the pool is fetched"""
if
not
self
.
is_everything_fetched
():
if
not
len
([
m
for
m
in
self
if
not
m
.
isfetched
])
==
0
:
logging
.
error
(
logging
.
error
(
"Fetching must be done before continuing.
\n
"
"Fetching must be done before continuing.
\n
"
"The following modules remains unfetched:
\n
"
"The following modules remains unfetched:
\n
"
...
@@ -142,51 +143,6 @@ class Action(list):
...
@@ -142,51 +143,6 @@ class Action(list):
return
module
return
module
return
None
return
None
def
is_everything_fetched
(
self
):
"""Check if every module is already fetched"""
if
len
([
m
for
m
in
self
if
not
m
.
isfetched
])
==
0
:
return
True
else
:
return
False
def
fetch_all
(
self
):
"""Fetch all the modules declared in the design"""
def
fetch_module
(
module
):
"""Fetch the given module from the remote origin"""
new_modules
=
[]
logging
.
debug
(
"Fetching module:
%
s"
,
str
(
module
))
backend
=
fetch
.
FETCH_TYPE_LOOKUP
.
get_backend
(
module
)
fetcher
=
backend
()
result
=
fetcher
.
fetch
(
module
)
if
result
is
False
:
logging
.
error
(
"Unable to fetch module
%
s"
,
str
(
module
.
url
))
sys
.
exit
(
"Exiting"
)
module
.
parse_manifest
()
new_modules
.
extend
(
module
.
local
)
new_modules
.
extend
(
module
.
svn
)
new_modules
.
extend
(
module
.
git
)
return
new_modules
fetch_queue
=
[
m
for
m
in
self
]
while
len
(
fetch_queue
)
>
0
:
cur_mod
=
fetch_queue
.
pop
()
new_modules
=
[]
if
cur_mod
.
isfetched
:
new_modules
=
cur_mod
.
submodules
()
else
:
new_modules
=
fetch_module
(
cur_mod
)
for
mod
in
new_modules
:
if
not
mod
.
isfetched
:
logging
.
debug
(
"Appended to fetch queue: "
+
str
(
mod
.
url
))
self
.
_add
(
mod
)
fetch_queue
.
append
(
mod
)
else
:
logging
.
debug
(
"NOT appended to fetch queue: "
+
str
(
mod
.
url
))
def
_add
(
self
,
new_module
):
def
_add
(
self
,
new_module
):
"""Add the given new module if this is not already in the pool"""
"""Add the given new module if this is not already in the pool"""
from
hdlmake.module
import
Module
from
hdlmake.module
import
Module
...
...
hdlmake/action/core.py
View file @
f456fda5
...
@@ -43,12 +43,50 @@ class ActionCore(Action):
...
@@ -43,12 +43,50 @@ class ActionCore(Action):
def
__init__
(
self
,
*
args
):
def
__init__
(
self
,
*
args
):
super
(
ActionCore
,
self
)
.
__init__
(
*
args
)
super
(
ActionCore
,
self
)
.
__init__
(
*
args
)
def
_fetch_all
(
self
):
"""Fetch all the modules declared in the design"""
def
_fetch_module
(
module
):
"""Fetch the given module from the remote origin"""
new_modules
=
[]
logging
.
debug
(
"Fetching module:
%
s"
,
str
(
module
))
backend
=
fetch
.
FETCH_TYPE_LOOKUP
.
get_backend
(
module
)
fetcher
=
backend
()
result
=
fetcher
.
fetch
(
module
)
if
result
is
False
:
logging
.
error
(
"Unable to fetch module
%
s"
,
str
(
module
.
url
))
sys
.
exit
(
"Exiting"
)
module
.
parse_manifest
()
new_modules
.
extend
(
module
.
local
)
new_modules
.
extend
(
module
.
svn
)
new_modules
.
extend
(
module
.
git
)
return
new_modules
fetch_queue
=
[
m
for
m
in
self
]
while
len
(
fetch_queue
)
>
0
:
cur_mod
=
fetch_queue
.
pop
()
new_modules
=
[]
if
cur_mod
.
isfetched
:
new_modules
=
cur_mod
.
submodules
()
else
:
new_modules
=
_fetch_module
(
cur_mod
)
for
mod
in
new_modules
:
if
not
mod
.
isfetched
:
logging
.
debug
(
"Appended to fetch queue: "
+
str
(
mod
.
url
))
self
.
_add
(
mod
)
fetch_queue
.
append
(
mod
)
else
:
logging
.
debug
(
"NOT appended to fetch queue: "
+
str
(
mod
.
url
))
def
fetch
(
self
):
def
fetch
(
self
):
"""Fetch the missing required modules from their remote origin"""
"""Fetch the missing required modules from their remote origin"""
top_module
=
self
.
get_top_module
()
top_module
=
self
.
get_top_module
()
logging
.
info
(
"Fetching needed modules."
)
logging
.
info
(
"Fetching needed modules."
)
os
.
system
(
top_module
.
manifest_dict
[
"fetch_pre_cmd"
])
os
.
system
(
top_module
.
manifest_dict
[
"fetch_pre_cmd"
])
self
.
fetch_all
()
self
.
_
fetch_all
()
os
.
system
(
top_module
.
manifest_dict
[
"fetch_post_cmd"
])
os
.
system
(
top_module
.
manifest_dict
[
"fetch_post_cmd"
])
logging
.
info
(
"All modules fetched."
)
logging
.
info
(
"All modules fetched."
)
...
...
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