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
07087474
Commit
07087474
authored
Oct 28, 2019
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
module.py: minor refactoring (add comments, move code).
parent
fa8d0961
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
24 deletions
+25
-24
module.py
hdlmake/module/module.py
+25
-24
No files found.
hdlmake/module/module.py
View file @
07087474
...
...
@@ -61,6 +61,8 @@ class Module(object):
"""
This is the class providing the HDLMake module, the basic element
providing the modular behavior allowing for structured designs.
Note: a module is identified by its URL.
"""
def
__init__
(
self
,
module_args
,
action
):
...
...
@@ -75,26 +77,26 @@ class Module(object):
self
.
incl_makefiles
=
[]
self
.
library
=
"work"
self
.
action
=
None
self
.
top_manifest
=
None
self
.
top_manifest
=
action
.
get_top_manifest
()
self
.
manifest_dict
=
{}
self
.
source
=
None
self
.
parent
=
None
self
.
source
=
module_args
.
source
# The fetcher (module, git, ...)
self
.
parent
=
module_args
.
parent
self
.
url
=
None
self
.
branch
=
None
self
.
revision
=
None
self
.
path
=
None
self
.
isfetched
=
False
self
.
path
=
None
# Relative path to the module.
self
.
isfetched
=
False
# True if the module exists on the file system.
self
.
init_config
(
module_args
)
self
.
action
=
action
self
.
top_manifest
=
action
.
get_top_manifest
()
self
.
module_args
=
module_args
def
__str__
(
self
):
return
self
.
module_args
.
url
def
init_config
(
self
,
module_args
):
"""This initializes the module configuration.
The function is executed by Module constructor"""
self
.
parent
=
module_args
.
parent
url
=
module_args
.
url
self
.
source
=
module_args
.
source
fetchto
=
module_args
.
fetchto
if
self
.
source
==
'local'
:
...
...
@@ -107,6 +109,7 @@ class Module(object):
self
.
path
=
path_mod
.
relpath
(
url
)
self
.
isfetched
=
True
else
:
# Split URL (extract basename, revision, branch...)
if
self
.
source
==
'svn'
:
self
.
url
,
self
.
revision
=
path_mod
.
svn_parse
(
url
)
basename
=
path_mod
.
svn_basename
(
self
.
url
)
...
...
@@ -147,14 +150,6 @@ class Module(object):
self
.
path
,
filepath
)
return
True
def
_make_list_of_paths
(
self
,
list_of_paths
):
"""Get a list with only the valid absolute paths from the provided"""
paths
=
[]
for
filepath
in
list_of_paths
:
if
self
.
_check_filepath
(
filepath
):
paths
.
append
(
path_mod
.
rel2abs
(
filepath
,
self
.
path
))
return
paths
def
process_manifest
(
self
):
"""Process the content section of the manifest_dict"""
logging
.
debug
(
"Process manifest at: "
+
os
.
path
.
dirname
(
self
.
path
))
...
...
@@ -166,13 +161,21 @@ class Module(object):
def
_process_manifest_universal
(
self
):
"""Method processing the universal manifest directives;
set library (inherited if not set)
and action
"""
set library (inherited if not set)
.
"""
# Libraries
if
"library"
in
self
.
manifest_dict
:
self
.
library
=
self
.
manifest_dict
[
"library"
]
elif
self
.
parent
:
self
.
library
=
self
.
parent
.
library
def
_make_list_of_paths
(
self
,
list_of_paths
):
"""Get a list with only the valid absolute paths from the provided"""
paths
=
[]
for
filepath
in
list_of_paths
:
if
self
.
_check_filepath
(
filepath
):
paths
.
append
(
path_mod
.
rel2abs
(
filepath
,
self
.
path
))
return
paths
def
_create_file_list_from_paths
(
self
,
paths
):
"""
Build a Source File Set containing the files indicated by the
...
...
@@ -268,10 +271,11 @@ class Module(object):
path
=
git_submodule_dict
[
submodule_key
][
"path"
]
path
=
os
.
path
.
join
(
git_toplevel
,
path
)
fetchto
=
os
.
path
.
sep
.
join
(
path
.
split
(
os
.
path
.
sep
)[:
-
1
])
self
.
modules
[
'git'
]
.
append
(
self
.
action
.
new_module
(
parent
=
self
,
url
=
url
,
fetchto
=
fetchto
,
source
=
'git'
))
self
.
modules
[
'git'
]
.
append
(
self
.
action
.
new_module
(
parent
=
self
,
url
=
url
,
fetchto
=
fetchto
,
source
=
'git'
))
def
_process_manifest_makefiles
(
self
):
"""Get the extra makefiles defined in the HDLMake module"""
...
...
@@ -287,9 +291,6 @@ class Module(object):
makefiles_paths
=
self
.
_make_list_of_paths
(
included_makefiles_aux
)
self
.
incl_makefiles
.
extend
(
makefiles_paths
)
def
__str__
(
self
):
return
self
.
module_args
.
url
def
submodules
(
self
):
"""Get a list with all the submodules this module instance requires"""
return
self
.
modules
[
'local'
]
+
self
.
modules
[
'git'
]
\
...
...
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