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
d8eed83f
Commit
d8eed83f
authored
Jul 25, 2016
by
Javier D. Garcia-Lasheras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A little bit of refactoring focused on module core
parent
f1d7e053
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
21 deletions
+43
-21
core.py
hdlmake/module/core.py
+39
-5
module.py
hdlmake/module/module.py
+0
-16
plugin.py
hdlmake/module/plugin.py
+4
-0
No files found.
hdlmake/module/core.py
View file @
d8eed83f
"""Provides the core functionality for the HDLMake module"""
import
os
import
logging
...
...
@@ -6,6 +8,7 @@ from hdlmake.util import path as path_mod
from
hdlmake
import
fetch
class
ModuleCore
(
ModulePlugin
):
"""This is the class providing the module core functionality"""
def
__init__
(
self
):
# Universal Manifest Properties
self
.
library
=
"work"
...
...
@@ -16,23 +19,54 @@ class ModuleCore(ModulePlugin):
# Manifest Force tool Property
self
.
force_tool
=
None
# Origin attributes
self
.
isfetched
=
False
# raw_url is the full url, including: branch, revision, commit, tag
self
.
raw_url
=
None
# url is stripped down web url, not including any other parameter
self
.
url
=
None
self
.
parent
=
None
self
.
source
=
None
self
.
branch
=
None
self
.
path
=
None
self
.
fetchto
=
None
self
.
revision
=
None
def
__str__
(
self
):
return
self
.
raw_url
@
property
def
basename
(
self
):
"""Get the basename for a module instance"""
if
self
.
source
==
fetch
.
SVN
:
return
path_mod
.
svn_basename
(
self
.
url
)
else
:
return
path_mod
.
url_basename
(
self
.
url
)
def
process_manifest
(
self
):
"""Method that process the core manifest section"""
self
.
_process_manifest_force_tool
()
self
.
_process_manifest_universal
()
super
(
ModuleCore
,
self
)
.
process_manifest
()
def
_process_manifest_force_tool
(
self
):
"""Method processing the force_tool manifest directive"""
if
self
.
manifest_dict
[
"force_tool"
]:
f
t
=
self
.
manifest_dict
[
"force_tool"
]
self
.
force_tool
=
f
t
.
split
(
' '
)
f
orce_tool
=
self
.
manifest_dict
[
"force_tool"
]
self
.
force_tool
=
f
orce_tool
.
split
(
' '
)
if
len
(
self
.
force_tool
)
!=
3
:
logging
.
warning
(
"Incorrect force_tool format
%
s. Ignoring"
%
self
.
force_tool
)
logging
.
warning
(
"Incorrect force_tool format
%
s. Ignoring"
,
self
.
force_tool
)
self
.
force_tool
=
None
def
_process_manifest_universal
(
self
):
if
"top_module"
in
self
.
manifest_dict
:
self
.
top_module
=
self
.
manifest_dict
[
"top_module"
]
"""Method processing the universal manifest directives"""
#if "top_module" in self.manifest_dict:
# self.top_module = self.manifest_dict["top_module"]
# Libraries
self
.
library
=
self
.
manifest_dict
[
"library"
]
self
.
target
=
self
.
manifest_dict
[
"target"
]
.
lower
()
...
...
hdlmake/module/module.py
View file @
d8eed83f
...
...
@@ -34,7 +34,6 @@ import logging
from
hdlmake.manifest_parser
import
Manifest
,
ManifestParser
from
hdlmake.util
import
path
as
path_mod
from
hdlmake
import
fetch
from
hdlmake.module
import
(
ModuleCore
,
ModuleSynthesis
,
ModuleSimulation
,
ModuleContent
,
ModuleAltera
)
...
...
@@ -46,14 +45,6 @@ class Module(ModuleCore, ModuleSynthesis,
providing the modular behavior allowing for structured designs.
"""
@
property
def
basename
(
self
):
"""Get the basename for a module instance"""
if
self
.
source
==
fetch
.
SVN
:
return
path_mod
.
svn_basename
(
self
.
url
)
else
:
return
path_mod
.
url_basename
(
self
.
url
)
def
set_pool
(
self
,
pool
):
"""Set the associated pool for the module instance"""
self
.
pool
=
pool
...
...
@@ -66,9 +57,6 @@ class Module(ModuleCore, ModuleSynthesis,
super
(
Module
,
self
)
.
__init__
()
self
.
manifest
=
None
self
.
manifest_dict
=
None
self
.
pool
=
None
self
.
top_module
=
None
...
...
@@ -78,10 +66,6 @@ class Module(ModuleCore, ModuleSynthesis,
self
.
_set_origin
(
parent
,
url
,
source
,
fetchto
)
def
__str__
(
self
):
return
self
.
raw_url
@
property
def
is_fetched_to
(
self
):
"""Get the path where the module instance resides"""
...
...
hdlmake/module/plugin.py
View file @
d8eed83f
class
ModulePlugin
(
object
):
def
__init__
(
self
):
self
.
manifest
=
None
self
.
manifest_dict
=
None
def
process_manifest
(
self
):
pass
...
...
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