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
8a382781
Commit
8a382781
authored
May 23, 2017
by
Javier D. Garcia-Lasheras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the logging settings to the module pool initialization
parent
1c2c2d1b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
24 deletions
+25
-24
__main__.py
hdlmake/__main__.py
+0
-24
action.py
hdlmake/action/action.py
+25
-0
No files found.
hdlmake/__main__.py
View file @
8a382781
...
...
@@ -26,11 +26,8 @@ from __future__ import print_function
from
__future__
import
absolute_import
import
os
import
argparse
import
logging
import
sys
from
.util
import
path
as
path_mod
from
.util.termcolor
import
colored
from
.manifest_parser
import
ManifestParser
from
.module_pool
import
ModulePool
from
.
import
fetch
as
fetch_mod
...
...
@@ -55,27 +52,6 @@ def main():
#
options
=
_get_options
(
sys
,
parser
)
# Here we set the log level (A.K.A.) debug verbosity)
numeric_level
=
getattr
(
logging
,
options
.
log
.
upper
(),
None
)
if
not
isinstance
(
numeric_level
,
int
):
sys
.
exit
(
'Invalid log level:
%
s'
%
options
.
log
)
if
not
path_mod
.
check_windows
():
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
)
logging
.
debug
(
str
(
options
))
# Create a ModulePool object, this will become our workspace
modules_pool
=
ModulePool
(
options
)
...
...
hdlmake/action/action.py
View file @
8a382781
...
...
@@ -30,9 +30,33 @@ from subprocess import PIPE, Popen
import
sys
from
hdlmake.util
import
path
as
path_mod
from
hdlmake.util.termcolor
import
colored
from
hdlmake
import
new_dep_solver
as
dep_solver
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
):
sys
.
exit
(
'Invalid log level:
%
s'
%
options
.
log
)
if
not
path_mod
.
check_windows
():
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
)
logging
.
debug
(
str
(
options
))
class
Action
(
list
):
"""This is the base class providing the common Action methods"""
...
...
@@ -41,6 +65,7 @@ class Action(list):
self
.
top_module
=
None
self
.
_deps_solved
=
False
self
.
options
=
options
set_logging_level
(
options
)
super
(
Action
,
self
)
.
__init__
()
def
new_module
(
self
,
parent
,
url
,
source
,
fetchto
):
...
...
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