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
2
Merge Requests
2
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
1bafa174
Commit
1bafa174
authored
Oct 01, 2019
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
main: the default command is 'makefile'. Refactoring.
parent
722a37d9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
18 deletions
+17
-18
commands.py
hdlmake/action/commands.py
+1
-1
main.py
hdlmake/main.py
+16
-17
No files found.
hdlmake/action/commands.py
View file @
1bafa174
...
...
@@ -68,7 +68,7 @@ class ActionCore(Action):
combined_fileset
.
add
(
self
.
privative_fileset
)
self
.
tool
.
write_makefile
(
self
.
config
,
combined_fileset
,
filename
=
self
.
options
.
filename
)
filename
=
self
.
options
.
__dict__
.
get
(
'filename'
)
)
def
_fetch_all
(
self
):
"""Fetch all the modules declared in the design"""
...
...
hdlmake/main.py
View file @
1bafa174
...
...
@@ -43,9 +43,13 @@ def hdlmake(args):
-- prepare the global module containing the heavy common stuff
"""
# Command 'makefile' is impled by '-f'.
if
len
(
args
)
==
2
and
args
[
0
]
in
(
'-f'
,
'--filename'
):
args
.
insert
(
0
,
'makefile'
)
# Options
parser
=
_get_parser
()
options
=
_get_options
(
args
,
parser
)
options
=
parser
.
parse_args
(
args
)
try
:
set_logging_level
(
options
)
...
...
@@ -71,7 +75,7 @@ def _action_runner(modules_pool):
options
=
modules_pool
.
options
if
options
.
command
==
"manifest-help"
:
ManifestParser
()
.
print_help
()
elif
options
.
command
==
"makefile"
:
elif
options
.
command
==
"makefile"
or
options
.
command
is
None
:
modules_pool
.
makefile
()
elif
options
.
command
==
"fetch"
:
modules_pool
.
fetch
()
...
...
@@ -83,8 +87,8 @@ def _action_runner(modules_pool):
modules_pool
.
list_files
()
elif
options
.
command
==
"tree"
:
modules_pool
.
generate_tree
()
el
if
options
.
command
is
Non
e
:
logging
.
info
(
"No command selected"
)
el
s
e
:
raise
AssertionError
def
_get_version_string
(
prog
):
...
...
@@ -102,18 +106,22 @@ def _get_parser():
+
"and fetching IP-Core libraries from remote repositories."
)
parser
=
argparse
.
ArgumentParser
(
"hdlmake"
,
description
=
description
)
subparsers
=
parser
.
add_subparsers
(
title
=
"commands"
,
dest
=
"command"
)
makefile
=
subparsers
.
add_parser
(
"makefile"
,
help
=
"write the Makefile (default action for hdlmake)"
)
makefile
.
add_argument
(
"-f"
,
"--filename"
,
default
=
None
,
dest
=
"filename"
,
help
=
"name for the Makefile file to be created"
)
subparsers
.
add_parser
(
"fetch"
,
help
=
"fetch and/or update all of the remote modules"
)
subparsers
.
add_parser
(
"clean"
,
help
=
"clean all of the already fetched remote modules"
)
listmod
=
subparsers
.
add_parser
(
"list-mods"
,
help
=
"list all modules together with their files"
)
...
...
@@ -123,6 +131,7 @@ def _get_parser():
listmod
.
add_argument
(
"--terse"
,
default
=
False
,
action
=
"store_true"
,
dest
=
"terse"
,
help
=
"do not print comments"
)
listfiles
=
subparsers
.
add_parser
(
"list-files"
,
help
=
"list all of the files in the design hierarchy"
)
...
...
@@ -135,6 +144,7 @@ def _get_parser():
listfiles
.
add_argument
(
"--top"
,
dest
=
"top"
,
default
=
None
,
help
=
"print only those files required to build 'top'"
)
tree
=
subparsers
.
add_parser
(
"tree"
,
help
=
"generate a module hierarchy tree graph"
)
...
...
@@ -145,9 +155,11 @@ def _get_parser():
"--mode"
,
dest
=
"mode"
,
default
=
"mods"
,
help
=
"set the working mode for the tree generator: "
"(mods, dfs, bfs)"
)
subparsers
.
add_parser
(
"manifest-help"
,
help
=
"print manifest file variables description"
)
parser
.
add_argument
(
'-v'
,
'--version'
,
action
=
'version'
,
help
=
"print the version of this program"
,
...
...
@@ -196,19 +208,6 @@ def set_logging_level(options):
logging
.
debug
(
str
(
options
))
def
_get_options
(
args
,
parser
):
"""Function that decodes and set the provided command user options"""
options
=
None
if
len
(
args
)
==
0
:
options
=
parser
.
parse_args
([
'makefile'
])
elif
len
(
args
)
==
2
and
(
args
[
0
]
==
'-f'
or
args
[
0
]
==
'--filename'
):
options
=
parser
.
parse_args
([
'makefile'
]
+
args
)
else
:
options
=
parser
.
parse_args
(
args
)
return
options
def
main
():
"""Entry point used by the executable"""
hdlmake
(
sys
.
argv
[
1
:])
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