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
417d1f93
Commit
417d1f93
authored
Mar 04, 2020
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor renaming. Add comments.
parent
82d2f907
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
20 deletions
+19
-20
action.py
hdlmake/action/action.py
+9
-10
commands.py
hdlmake/action/commands.py
+8
-8
new_dep_solver.py
hdlmake/sourcefiles/new_dep_solver.py
+2
-2
No files found.
hdlmake/action/action.py
View file @
417d1f93
...
...
@@ -42,7 +42,7 @@ class Action(object):
def
__init__
(
self
,
options
):
super
(
Action
,
self
)
.
__init__
()
self
.
top_manifest
=
None
self
.
manifests
=
[]
self
.
all_
manifests
=
[]
self
.
parseable_fileset
=
SourceFileSet
()
self
.
privative_fileset
=
SourceFileSet
()
self
.
_deps_solved
=
False
...
...
@@ -55,7 +55,7 @@ class Action(object):
Thanks to it the pool can easily control its content
"""
# If the module is already present, do not create it.
for
mod
in
self
.
manifests
:
for
mod
in
self
.
all_
manifests
:
if
mod
.
url
==
url
:
return
None
# A new module will be added, dependencies have to be computed.
...
...
@@ -63,7 +63,7 @@ class Action(object):
args
=
ModuleArgs
()
args
.
set_args
(
parent
,
url
,
source
,
fetchto
)
res
=
Module
(
args
,
self
)
self
.
manifests
.
append
(
res
)
self
.
all_
manifests
.
append
(
res
)
return
res
def
load_all_manifests
(
self
):
...
...
@@ -106,7 +106,7 @@ class Action(object):
"""Build file set with all the files listed in the complete pool"""
logging
.
debug
(
"Begin build complete file set"
)
all_manifested_files
=
SourceFileSet
()
for
manifest
in
self
.
manifests
:
for
manifest
in
self
.
all_
manifests
:
all_manifested_files
.
add
(
manifest
.
files
)
logging
.
debug
(
"End build complete file set"
)
return
all_manifested_files
...
...
@@ -143,11 +143,10 @@ class Action(object):
def
solve_file_set
(
self
):
"""Build file set with only those files required by the top entity"""
if
not
self
.
_deps_solved
:
if
self
.
tool
==
None
:
dep_solver
.
solve
(
self
.
parseable_fileset
)
else
:
dep_solver
.
solve
(
self
.
parseable_fileset
,
self
.
tool
.
get_standard_libs
())
libs
=
None
if
self
.
tool
is
not
None
:
libs
=
self
.
tool
.
get_standard_libs
()
dep_solver
.
solve
(
self
.
parseable_fileset
,
libs
)
self
.
_deps_solved
=
True
if
self
.
options
.
all_files
:
# If option -all is used, no need to compute dependencies.
...
...
@@ -164,4 +163,4 @@ class Action(object):
def
__str__
(
self
):
"""Cast the module list as a list of strings"""
return
str
([
str
(
m
)
for
m
in
self
.
manifests
])
return
str
([
str
(
m
)
for
m
in
self
.
all_
manifests
])
hdlmake/action/commands.py
View file @
417d1f93
...
...
@@ -51,12 +51,12 @@ class Commands(Action):
def
_check_all_fetched
(
self
):
"""Check if every module in the pool is fetched"""
if
not
len
([
m
for
m
in
self
.
manifests
if
not
m
.
isfetched
])
==
0
:
if
not
len
([
m
for
m
in
self
.
all_
manifests
if
not
m
.
isfetched
])
==
0
:
raise
Exception
(
"Fetching should be done before continuing.
\n
"
"The following modules remains unfetched:
\n
"
" {}"
.
format
(
"
\n
"
.
join
([
str
(
m
)
for
m
in
self
.
manifests
"
\n
"
.
join
([
str
(
m
)
for
m
in
self
.
all_
manifests
if
not
m
.
isfetched
])))
def
makefile
(
self
):
...
...
@@ -98,7 +98,7 @@ class Commands(Action):
new_modules
.
extend
(
module
.
modules
[
m
])
return
new_modules
fetch_queue
=
self
.
manifests
[:]
# Need a copy of the list
fetch_queue
=
self
.
all_
manifests
[:]
# Need a copy of the list
while
len
(
fetch_queue
)
>
0
:
cur_mod
=
fetch_queue
.
pop
()
...
...
@@ -119,12 +119,12 @@ class Commands(Action):
def
fetch
(
self
):
"""Fetch the missing required modules from their remote origin"""
logging
.
info
(
"Fetching needed modules."
)
for
mod
in
self
.
manifests
:
for
mod
in
self
.
all_
manifests
:
if
mod
.
isfetched
and
not
mod
.
manifest_dict
==
None
:
if
'fetch_pre_cmd'
in
mod
.
manifest_dict
:
os
.
system
(
mod
.
manifest_dict
.
get
(
"fetch_pre_cmd"
,
''
))
self
.
_fetch_all
()
for
mod
in
self
.
manifests
:
for
mod
in
self
.
all_
manifests
:
if
mod
.
isfetched
and
not
mod
.
manifest_dict
==
None
:
if
'fetch_post_cmd'
in
mod
.
manifest_dict
:
os
.
system
(
mod
.
manifest_dict
.
get
(
"fetch_post_cmd"
,
''
))
...
...
@@ -133,7 +133,7 @@ class Commands(Action):
def
clean
(
self
):
"""Delete the local copy of the fetched modules"""
logging
.
info
(
"Removing fetched modules.."
)
remove_list
=
[
mod_aux
for
mod_aux
in
self
.
manifests
remove_list
=
[
mod_aux
for
mod_aux
in
self
.
all_
manifests
if
mod_aux
.
source
in
[
'git'
,
'gitsm'
,
'svn'
]
and
mod_aux
.
isfetched
]
remove_list
.
reverse
()
# we will remove modules in backward order
...
...
@@ -177,7 +177,7 @@ class Commands(Action):
def
list_files
(
self
):
"""List the files added to the design across the pool hierarchy"""
unfetched_modules
=
[
mod_aux
for
mod_aux
in
self
.
manifests
unfetched_modules
=
[
mod_aux
for
mod_aux
in
self
.
all_
manifests
if
not
mod_aux
.
isfetched
]
for
mod_aux
in
unfetched_modules
:
logging
.
warning
(
...
...
@@ -214,7 +214,7 @@ class Commands(Action):
def
list_modules
(
self
):
"""List the modules that are contained by the pool"""
for
mod_aux
in
self
.
manifests
:
for
mod_aux
in
self
.
all_
manifests
:
if
not
mod_aux
.
isfetched
:
logging
.
warning
(
"Module not fetched:
%
s"
,
mod_aux
.
url
)
self
.
_print_comment
(
"# MODULE UNFETCHED! ->
%
s"
%
mod_aux
.
url
)
...
...
hdlmake/sourcefiles/new_dep_solver.py
View file @
417d1f93
...
...
@@ -49,8 +49,8 @@ def solve(fileset, standard_libs=None):
from
.dep_file
import
DepRelation
assert
isinstance
(
fileset
,
SourceFileSet
)
fset
=
fileset
.
filter
(
DepFile
)
# print(fileset)
#
print(fset)
#
Parse source files
logging
.
debug
(
"PARSE BEGIN: Here, we will parse all the files in the "
"fileset: no parsing should be done beyond this point"
)
for
investigated_file
in
fset
:
...
...
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