Skip to content

Commit

Permalink
Merge pull request #122 from ipbus/bugfix/utils_import
Browse files Browse the repository at this point in the history
Bugfix: utils import
  • Loading branch information
alessandrothea authored Mar 16, 2021
2 parents de34506 + 606423b commit c1ace5e
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/ipbb/cmds/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion src/ipbb/cmds/dep.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ipbb/cmds/ipbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

# ------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/ipbb/cmds/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ipbb/cmds/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from click import echo, secho, style, confirm

# Tools imports
from ._utils import (
from ..utils import (
DirSentry,
ensureNoMissingFiles,
echoVivadoConsoleError,
Expand Down
2 changes: 1 addition & 1 deletion src/ipbb/cmds/vivadohls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/ipbb/depparser/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

from ._fileparser import DepFileParser, DepFormatter, depfiletypes
from ._pathmaker import Pathmaker
from ._definitions import *
from ._definitions import *
from ._formatters import *
16 changes: 16 additions & 0 deletions src/ipbb/cmds/formatters.py → src/ipbb/depparser/_formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
# -----------------------------------------------------------------------------
5 changes: 2 additions & 3 deletions src/ipbb/scripts/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from click import echo, style, secho

from ..context import Context
from ..cmds.formatters import DepFormatter

from .._version import __version__

Expand All @@ -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


# ------------------------------------------------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions src/ipbb/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/scripts/generate-ipbb-repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def cli(repofile, dest):
pprint.pprint(dp.unresolved)

df = DepFormatter(dp)
print(df.summary())
print(df.drawSummary())


def main():
Expand All @@ -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

Expand Down

0 comments on commit c1ace5e

Please sign in to comment.