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
1d55f716
Commit
1d55f716
authored
Oct 30, 2019
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dep_file.py: split rels set into requires/provides.
parent
f7cfce26
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
39 deletions
+39
-39
dep_file.py
hdlmake/sourcefiles/dep_file.py
+6
-5
new_dep_solver.py
hdlmake/sourcefiles/new_dep_solver.py
+33
-34
No files found.
hdlmake/sourcefiles/dep_file.py
View file @
1d55f716
...
@@ -146,27 +146,28 @@ class DepFile(File):
...
@@ -146,27 +146,28 @@ class DepFile(File):
def
__init__
(
self
,
path
,
module
):
def
__init__
(
self
,
path
,
module
):
assert
isinstance
(
path
,
six
.
string_types
)
assert
isinstance
(
path
,
six
.
string_types
)
File
.
__init__
(
self
,
path
=
path
,
module
=
module
)
File
.
__init__
(
self
,
path
=
path
,
module
=
module
)
self
.
rels
=
set
()
self
.
provides
=
set
()
self
.
depends_on
=
set
()
self
.
requires
=
set
()
self
.
depends_on
=
set
()
# Set of files this file depends on.
self
.
dep_level
=
None
self
.
dep_level
=
None
self
.
is_parsed
=
False
self
.
is_parsed
=
False
def
add_require
(
self
,
rel
):
def
add_require
(
self
,
rel
):
"""Add dependency :param rel:"""
"""Add dependency :param rel:"""
assert
rel
.
direction
==
DepRelation
.
USE
assert
rel
.
direction
==
DepRelation
.
USE
self
.
re
l
s
.
add
(
rel
)
self
.
re
quire
s
.
add
(
rel
)
def
add_provide
(
self
,
rel
):
def
add_provide
(
self
,
rel
):
"""Add provide :param rel:"""
"""Add provide :param rel:"""
assert
rel
.
direction
==
DepRelation
.
PROVIDE
assert
rel
.
direction
==
DepRelation
.
PROVIDE
self
.
rel
s
.
add
(
rel
)
self
.
provide
s
.
add
(
rel
)
def
satisfies
(
self
,
rel_b
):
def
satisfies
(
self
,
rel_b
):
"""Check if any of the file object relations match any of the relations
"""Check if any of the file object relations match any of the relations
listed in the parameter (rel_b)"""
listed in the parameter (rel_b)"""
assert
isinstance
(
rel_b
,
DepRelation
)
assert
isinstance
(
rel_b
,
DepRelation
)
# self._parse_if_needed()
# self._parse_if_needed()
return
any
([
x
.
satisfies
(
rel_b
)
for
x
in
self
.
rel
s
])
return
any
([
x
.
satisfies
(
rel_b
)
for
x
in
self
.
provide
s
])
def
get_dep_level
(
self
):
def
get_dep_level
(
self
):
"""Get the dependency level for the file instance, so we can order
"""Get the dependency level for the file instance, so we can order
...
...
hdlmake/sourcefiles/new_dep_solver.py
View file @
1d55f716
...
@@ -64,12 +64,11 @@ def solve(fileset, standard_libs=None):
...
@@ -64,12 +64,11 @@ def solve(fileset, standard_libs=None):
not_satisfied
=
0
not_satisfied
=
0
for
investigated_file
in
fset
:
for
investigated_file
in
fset
:
# logging.info("INVESTIGATED FILE: %s" % investigated_file)
# logging.info("INVESTIGATED FILE: %s" % investigated_file)
# print(investigated_file.rels)
for
rel
in
investigated_file
.
requires
:
for
rel
in
investigated_file
.
rels
:
# logging.info("- relation: %s" % rel)
# logging.info("- relation: %s" % rel)
# logging.info("- direction: %s" % rel.direction)
# logging.info("- direction: %s" % rel.direction)
# Only analyze USE relations, we are looking for dependencies
# Only analyze USE relations, we are looking for dependencies
if
rel
.
direction
==
DepRelation
.
USE
:
assert
rel
.
direction
==
DepRelation
.
USE
satisfied_by
=
set
()
satisfied_by
=
set
()
for
dep_file
in
fset
:
for
dep_file
in
fset
:
if
dep_file
.
satisfies
(
rel
):
if
dep_file
.
satisfies
(
rel
):
...
@@ -141,7 +140,7 @@ def make_dependency_set(fileset, top_level_entity, extra_modules=None):
...
@@ -141,7 +140,7 @@ def make_dependency_set(fileset, top_level_entity, extra_modules=None):
entity_rel_vlog
=
DepRelation
(
entity_rel_vlog
=
DepRelation
(
"
%
s.
%
s"
%
"
%
s.
%
s"
%
(
"work"
,
entity_name
),
DepRelation
.
PROVIDE
,
DepRelation
.
MODULE
)
(
"work"
,
entity_name
),
DepRelation
.
PROVIDE
,
DepRelation
.
MODULE
)
for
rel
in
test_file
.
rel
s
:
for
rel
in
test_file
.
provide
s
:
if
(
rel
==
entity_rel_vhdl
)
or
(
rel
==
entity_rel_vlog
):
if
(
rel
==
entity_rel_vhdl
)
or
(
rel
==
entity_rel_vlog
):
return
True
return
True
return
False
return
False
...
...
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