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
4aabbf99
Commit
4aabbf99
authored
Aug 16, 2013
by
Paweł Szostek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
colorful logging
parent
6e92c417
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
__main__.py
hdlmake/__main__.py
+21
-6
No files found.
hdlmake/__main__.py
View file @
4aabbf99
...
...
@@ -26,6 +26,7 @@ import global_mod
import
argparse
import
logging
import
sys
from
util.termcolor
import
colored
from
manifest_parser
import
ManifestParser
from
module_pool
import
ModulePool
from
env
import
Env
...
...
@@ -40,12 +41,24 @@ except:
def
main
():
parser
=
argparse
.
ArgumentParser
(
"hdlmake"
,
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
)
usage
=
"""hdlmake [command] [options]"""
description
=
"""To see optional arguments for particular command type:
hdlmake <command> --help
\0
"""
parser
=
argparse
.
ArgumentParser
(
"hdlmake"
,
usage
=
usage
,
description
=
description
)
subparsers
=
parser
.
add_subparsers
(
title
=
"commands"
,
dest
=
"command"
)
check_env
=
subparsers
.
add_parser
(
"check-env"
,
help
=
"check environment for HDLMAKE-related settings"
)
check_manifest
=
subparsers
.
add_parser
(
"check-manifest"
,
help
=
"check manifest for formal correctness"
)
check_manifest
.
add_argument
(
"--top"
,
help
=
"indicate path to the top manifest"
,
default
=
None
)
check_env
=
subparsers
.
add_parser
(
"check-env"
,
help
=
"check environment for HDLMAKE-related settings"
,
description
=
"Look for environmental variables specific for HDLMAKE.
\n
"
"Hdlmake will examine presence of supported synthesis and simulation"
"tools.
\n
"
)
# check_manifest = subparsers.add_parser("check-manifest", help="check manifest for formal correctness")
# check_manifest.add_argument("--top", help="indicate path to the top manifest", default=None)
manifest_help
=
subparsers
.
add_parser
(
"manifest-help"
,
help
=
"print manifest file variables description"
)
auto
=
subparsers
.
add_parser
(
"auto"
,
help
=
"default action for hdlmake. Run when no args are given"
)
auto
.
add_argument
(
"--noprune"
,
help
=
"prevent hdlmake from pruning unneeded files"
,
default
=
False
,
action
=
"store_true"
)
...
...
@@ -53,7 +66,7 @@ def main():
fetch
.
add_argument
(
"--flatten"
,
help
=
"`flatten' modules' hierarchy by storing everything in top module's fetchto direactoru"
,
default
=
False
,
action
=
"store_true"
)
fetch
.
add_argument
(
"--update"
,
help
=
"force updating of the fetched modules"
,
default
=
False
,
action
=
"store_true"
)
clean
=
subparsers
.
add_parser
(
"clean"
,
help
=
"remove all modules fetched for
this on
e"
)
clean
=
subparsers
.
add_parser
(
"clean"
,
help
=
"remove all modules fetched for
direct and indirect children of this modul
e"
)
listmod
=
subparsers
.
add_parser
(
"list-mods"
,
help
=
"List all modules together with their files"
)
listmod
.
add_argument
(
"--with-files"
,
help
=
"list modules together with their files"
,
default
=
False
,
action
=
"store_true"
,
dest
=
"withfiles"
)
listfiles
=
subparsers
.
add_parser
(
"list-files"
,
help
=
"List all files in a form of a space-separated string"
)
...
...
@@ -77,6 +90,8 @@ def main():
if
len
(
sys
.
argv
)
<
2
:
options
=
parser
.
parse_args
([
'auto'
])
elif
len
(
sys
.
argv
)
==
2
and
sys
.
argv
[
1
][:
5
]
==
"--log"
:
options
=
parser
.
parse_args
(
sys
.
argv
[
1
:]
+
[
'auto'
])
elif
sys
.
argv
[
1
]
==
"_conditioncheck"
:
options
=
condition_check
.
parse_args
(
sys
.
argv
[
2
:])
env
=
Env
(
options
)
...
...
@@ -91,7 +106,7 @@ def main():
if
not
isinstance
(
numeric_level
,
int
):
sys
.
exit
(
'Invalid log level:
%
s'
%
options
.
log
)
logging
.
basicConfig
(
format
=
"
%(levelname)
s
%(funcName)
s()
%(filename)
s:
%(lineno)
d:
%(message)
s"
,
level
=
numeric_level
)
logging
.
basicConfig
(
format
=
colored
(
"
%(levelname)
s"
,
"yellow"
)
+
colored
(
"
\t
%(filename)
s:
%(lineno)
d:
%(funcName)
s()
\t
"
,
"blue"
)
+
"
%(message)
s"
,
level
=
numeric_level
)
logging
.
debug
(
str
(
options
))
modules_pool
=
ModulePool
()
...
...
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