diff --git a/src/ipbb/cmds/common.py b/src/ipbb/cmds/common.py index e0255ad6..8ee5b7e2 100644 --- a/src/ipbb/cmds/common.py +++ b/src/ipbb/cmds/common.py @@ -7,7 +7,7 @@ from click import echo, secho, style, confirm from os.path import join, split, exists, abspath, splitext, relpath, basename from ..defaults import kProjAreaFile, kProjUserFile -from ._utils import DirSentry, formatDictTable +from ..utils import DirSentry, formatDictTable from ..tools.common import which diff --git a/src/ipbb/cmds/dep.py b/src/ipbb/cmds/dep.py index e61d3a55..2a655314 100644 --- a/src/ipbb/cmds/dep.py +++ b/src/ipbb/cmds/dep.py @@ -22,7 +22,7 @@ isdir, ) from ..tools.common import which, SmartOpen -from .formatters import DepFormatter +from ..depparser import DepFormatter from ..utils import DirSentry, printDictTable, printAlienTable from click import echo, secho, style, confirm from texttable import Texttable diff --git a/src/ipbb/cmds/ipbus.py b/src/ipbb/cmds/ipbus.py index f176523d..14449271 100644 --- a/src/ipbb/cmds/ipbus.py +++ b/src/ipbb/cmds/ipbus.py @@ -8,7 +8,7 @@ from os.path import join, split, exists, abspath, splitext, relpath, basename from ..defaults import kProjAreaFile, kProjUserFile from ..tools.common import which, DEFAULT_ENCODING -from ._utils import DirSentry, formatDictTable +from ..utils import DirSentry, formatDictTable from .common import addrtab # ------------------------------------------------------------------------------ diff --git a/src/ipbb/cmds/repo.py b/src/ipbb/cmds/repo.py index e52cde63..2fcb7015 100644 --- a/src/ipbb/cmds/repo.py +++ b/src/ipbb/cmds/repo.py @@ -15,7 +15,7 @@ from ..depparser import Pathmaker from ..tools.common import mkdir from ..utils import DirSentry, findFileInParents, raiseError, formatDictTable -from .formatters import DepFormatter +from ..depparser import DepFormatter from .proj import info as proj_info from urllib.parse import urlparse from distutils.dir_util import mkpath diff --git a/src/ipbb/cmds/sim.py b/src/ipbb/cmds/sim.py index 5492c8e1..d9de507e 100644 --- a/src/ipbb/cmds/sim.py +++ b/src/ipbb/cmds/sim.py @@ -29,7 +29,7 @@ from click import echo, secho, style, confirm # Tools imports -from ._utils import ( +from ..utils import ( DirSentry, ensureNoMissingFiles, echoVivadoConsoleError, diff --git a/src/ipbb/cmds/vivadohls.py b/src/ipbb/cmds/vivadohls.py index 9e70783f..58267fd9 100644 --- a/src/ipbb/cmds/vivadohls.py +++ b/src/ipbb/cmds/vivadohls.py @@ -7,7 +7,7 @@ from click import echo, secho, style, confirm from ..tools.common import which, SmartOpen -from ._utils import ensureNoParsingErrors, ensureNoMissingFiles, echoVivadoConsoleError +from ..utils import ensureNoParsingErrors, ensureNoMissingFiles, echoVivadoConsoleError from ..generators.vivadohlsproject import VivadoHlsProjectGenerator from ..tools.xilinx import VivadoHLSSession, VivadoHLSConsoleError diff --git a/src/ipbb/depparser/__init__.py b/src/ipbb/depparser/__init__.py index 53a7f47a..3132ae5b 100644 --- a/src/ipbb/depparser/__init__.py +++ b/src/ipbb/depparser/__init__.py @@ -1,4 +1,5 @@ from ._fileparser import DepFileParser, DepFormatter, depfiletypes from ._pathmaker import Pathmaker -from ._definitions import * \ No newline at end of file +from ._definitions import * +from ._formatters import * \ No newline at end of file diff --git a/src/ipbb/cmds/formatters.py b/src/ipbb/depparser/_formatters.py similarity index 89% rename from src/ipbb/cmds/formatters.py rename to src/ipbb/depparser/_formatters.py index 51472e7c..e6e82b90 100644 --- a/src/ipbb/cmds/formatters.py +++ b/src/ipbb/depparser/_formatters.py @@ -150,3 +150,19 @@ def drawParsingErrors(self): return lErrTable.draw() + # ----------------------------------------------------------------------------- + def drawSummary(self): + + lOutTxt = '' + lOutTxt += self.drawDeptreeCommandsSummary() + + lOutTxt += '\n' + lOutTxt += self.drawPackages() + + if self.parser.unresolved: + lOutTxt += '\n' + lOutTxt += self.drawUnresolvedSummary() + return lOutTxt + + return lOutTxt + # ----------------------------------------------------------------------------- \ No newline at end of file diff --git a/src/ipbb/scripts/builder.py b/src/ipbb/scripts/builder.py index 990f94cb..a0769145 100755 --- a/src/ipbb/scripts/builder.py +++ b/src/ipbb/scripts/builder.py @@ -11,7 +11,6 @@ from click import echo, style, secho from ..context import Context -from ..cmds.formatters import DepFormatter from .._version import __version__ @@ -32,9 +31,9 @@ @click.pass_context @click.version_option() def climain(ctx, aExcStack): - env = ctx.obj + ictx = ctx.obj - env.printExceptionStack = aExcStack + ictx.printExceptionStack = aExcStack # ------------------------------------------------------------------------------ diff --git a/src/ipbb/utils.py b/src/ipbb/utils.py index 1f6a9792..5e926272 100644 --- a/src/ipbb/utils.py +++ b/src/ipbb/utils.py @@ -8,6 +8,7 @@ from texttable import Texttable from os.path import join, relpath, exists, split, realpath from .tools.alien import AlienBranch +from .depparser import DepFormatter # ------------------------------------------------------------------------------ class DirSentry: @@ -104,7 +105,6 @@ def ensureNoParsingErrors(aCurrentProj, aDepFileParser): if not aDepFileParser.errors: return - from .cmds.formatters import DepFormatter fmt = DepFormatter(aDepFileParser) secho("ERROR: Project '{}' contains {} parsing error{}.".format( aCurrentProj, @@ -127,7 +127,6 @@ def ensureNoMissingFiles(aCurrentProj, aDepFileParser): if not aDepFileParser.unresolved: return - from .cmds.formatters import DepFormatter fmt = DepFormatter(aDepFileParser) secho("ERROR: Project '{}' contains unresolved dependencies: {} unresolved file{}.".format( aCurrentProj, diff --git a/tests/scripts/generate-ipbb-repo.py b/tests/scripts/generate-ipbb-repo.py index 239b5483..9b14ace2 100755 --- a/tests/scripts/generate-ipbb-repo.py +++ b/tests/scripts/generate-ipbb-repo.py @@ -61,7 +61,7 @@ def cli(repofile, dest): pprint.pprint(dp.unresolved) df = DepFormatter(dp) - print(df.summary()) + print(df.drawSummary()) def main(): @@ -72,7 +72,7 @@ def main(): echo() secho(hline, fg='red') secho("FATAL ERROR: Caught '" + type(e).__name__ + "' exception:", fg='red') - secho(e.message, fg='red') + secho(e, fg='red') secho(hline, fg='red') import StringIO