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
074d28a8
Commit
074d28a8
authored
Jun 11, 2019
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
action.py: move set_logging_level to __main__
parent
1047c915
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
36 deletions
+28
-36
__main__.py
hdlmake/__main__.py
+28
-10
action.py
hdlmake/action/action.py
+0
-26
No files found.
hdlmake/__main__.py
View file @
074d28a8
...
@@ -27,6 +27,8 @@ from __future__ import absolute_import
...
@@ -27,6 +27,8 @@ from __future__ import absolute_import
import
argparse
import
argparse
import
sys
import
sys
import
logging
import
logging
from
hdlmake.util
import
shell
from
hdlmake.util.termcolor
import
colored
from
.manifest_parser
import
ManifestParser
from
.manifest_parser
import
ManifestParser
from
.action.core
import
ActionCore
from
.action.core
import
ActionCore
...
@@ -41,17 +43,13 @@ def hdlmake(args):
...
@@ -41,17 +43,13 @@ def hdlmake(args):
-- prepare the global module containing the heavy common stuff
-- prepare the global module containing the heavy common stuff
"""
"""
#
# Options
# SET & GET PARSER
#
parser
=
_get_parser
()
parser
=
_get_parser
()
#
# PARSE & GET OPTIONS
#
options
=
_get_options
(
args
,
parser
)
options
=
_get_options
(
args
,
parser
)
try
:
try
:
set_logging_level
(
options
)
# Create a ModulePool object, this will become our workspace
# Create a ModulePool object, this will become our workspace
action
=
ActionCore
(
options
)
action
=
ActionCore
(
options
)
action
.
load_top_module
()
action
.
load_top_module
()
...
@@ -207,6 +205,29 @@ def _get_parser():
...
@@ -207,6 +205,29 @@ def _get_parser():
help
=
"display full error log with traceback"
)
help
=
"display full error log with traceback"
)
return
parser
return
parser
def
set_logging_level
(
options
):
"""Set the log level and config (A.K.A. log verbosity)"""
numeric_level
=
getattr
(
logging
,
options
.
log
.
upper
(),
None
)
if
not
isinstance
(
numeric_level
,
int
):
raise
Exception
(
'Invalid log level:
%
s'
%
options
.
log
)
if
not
shell
.
check_windows
()
and
options
.
logfile
==
None
:
logging
.
basicConfig
(
format
=
colored
(
"
%(levelname)
s"
,
"yellow"
)
+
colored
(
"
\t
%(filename)
s:
%(lineno)
d:
%(funcName)
s()
\t
"
,
"blue"
)
+
"
%(message)
s"
,
level
=
numeric_level
)
else
:
logging
.
basicConfig
(
format
=
"
%(levelname)
s"
+
"
\t
%(filename)
s:
%(lineno)
d:
%(funcName)
s()
\t
"
+
"
%(message)
s"
,
level
=
numeric_level
,
filename
=
options
.
logfile
)
logging
.
debug
(
str
(
options
))
def
_get_options
(
args
,
parser
):
def
_get_options
(
args
,
parser
):
"""Function that decodes and set the provided command user options"""
"""Function that decodes and set the provided command user options"""
...
@@ -224,6 +245,3 @@ def _get_options(args, parser):
...
@@ -224,6 +245,3 @@ def _get_options(args, parser):
def
main
():
def
main
():
"""Entry point used by the executable"""
"""Entry point used by the executable"""
hdlmake
(
sys
.
argv
[
1
:])
hdlmake
(
sys
.
argv
[
1
:])
if
__name__
==
"__main__"
:
main
()
hdlmake/action/action.py
View file @
074d28a8
...
@@ -30,34 +30,9 @@ import sys
...
@@ -30,34 +30,9 @@ import sys
from
hdlmake.tools.makefile_writer
import
load_syn_tool
,
load_sim_tool
from
hdlmake.tools.makefile_writer
import
load_syn_tool
,
load_sim_tool
from
hdlmake.util
import
shell
from
hdlmake.util
import
shell
from
hdlmake.util.termcolor
import
colored
from
hdlmake
import
new_dep_solver
as
dep_solver
from
hdlmake
import
new_dep_solver
as
dep_solver
from
hdlmake.srcfile
import
SourceFileSet
,
VHDLFile
,
VerilogFile
,
SVFile
from
hdlmake.srcfile
import
SourceFileSet
,
VHDLFile
,
VerilogFile
,
SVFile
def
set_logging_level
(
options
):
"""Set the log level and config (A.K.A. log verbosity)"""
numeric_level
=
getattr
(
logging
,
options
.
log
.
upper
(),
None
)
if
not
isinstance
(
numeric_level
,
int
):
raise
Exception
(
'Invalid log level:
%
s'
%
options
.
log
)
if
not
shell
.
check_windows
()
and
options
.
logfile
==
None
:
logging
.
basicConfig
(
format
=
colored
(
"
%(levelname)
s"
,
"yellow"
)
+
colored
(
"
\t
%(filename)
s:
%(lineno)
d:
%(funcName)
s()
\t
"
,
"blue"
)
+
"
%(message)
s"
,
level
=
numeric_level
)
else
:
logging
.
basicConfig
(
format
=
"
%(levelname)
s"
+
"
\t
%(filename)
s:
%(lineno)
d:
%(funcName)
s()
\t
"
+
"
%(message)
s"
,
level
=
numeric_level
,
filename
=
options
.
logfile
)
logging
.
debug
(
str
(
options
))
class
Action
(
list
):
class
Action
(
list
):
"""This is the base class providing the common Action methods"""
"""This is the base class providing the common Action methods"""
...
@@ -69,7 +44,6 @@ class Action(list):
...
@@ -69,7 +44,6 @@ class Action(list):
self
.
privative_fileset
=
SourceFileSet
()
self
.
privative_fileset
=
SourceFileSet
()
self
.
_deps_solved
=
False
self
.
_deps_solved
=
False
self
.
options
=
options
self
.
options
=
options
set_logging_level
(
options
)
def
load_top_module
(
self
):
def
load_top_module
(
self
):
# Top level module.
# Top level module.
...
...
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