sonar/database.py
def add(tool_name, version, cad_exe, hls_exe, sim_exe, script):
        """
        Add a new tool to the database

        Args:
            tool_name (str): Name of the tool
            version (str): Tool version
            cad_exe (str): Name of CAD tool executable. None if not applicable
            hls_exe (str): Name of HLS tool executable. None if not applicable
            sim_exe (str): Name of simulation tool executable. None if not applicable
            script (str): Shell script to initialize the tool

        Raises:
            SonarInvalidOpError: Raised if attempting to add an already existing
                tool.
        """
        with shelve.open(Constants.SONAR_DB_PATH) as db:
            tools = db["tool"]
            try:
                _dict = tools[tool_name]
            except KeyError:
                _dict = {"versions": [], "executable": {}, "script": {}}
            if version in _dict["versions"]:
                logger.error(
                    "%s already exists. Use 'edit' to modify existing tools",
                    version,
                )
                raise SonarInvalidOpError
            _dict["versions"].append(version)
            _dict["executable"]["cad"] = cad_exe
            _dict["executable"]["hls"] = hls_exe
            _dict["executable"]["sim"] = sim_exe
            _dict["script"][version] = script
            tools[tool_name] = _dict
            db["tool"] = tools

        Add a new tool to the database

        Args:
            tool_name (str): Name of the tool
            version (str): Tool version
            cad_exe (str): Name of CAD tool executable. None if not applicable
            hls_exe (str): Name of HLS tool executable. None if not applicable
            sim_exe (str): Name of simulation tool executable. None if not applicable
            script (str): Shell script to initialize the tool

        Raises:
            SonarInvalidOpError: Raised if attempting to add an already existing
                tool.
        
Add a new tool to the database
Add a new tool to the database
def add(tool_name, version, cad_exe, hls_exe, sim_exe, script):
        with shelve.open(Constants.SONAR_DB_PATH) as db:
            tools = db["tool"]
            try:
                _dict = tools[tool_name]
            except KeyError:
                _dict = {"versions": [], "executable": {}, "script": {}}
            if version in _dict["versions"]:
                logger.error(
                    "%s already exists. Use 'edit' to modify existing tools",
                    version,
                )
                raise SonarInvalidOpError
            _dict["versions"].append(version)
            _dict["executable"]["cad"] = cad_exe
            _dict["executable"]["hls"] = hls_exe
            _dict["executable"]["sim"] = sim_exe
            _dict["script"][version] = script
            tools[tool_name] = _dict
            db["tool"] = tools
def add ( tool_name , version , cad_exe , hls_exe , sim_exe , script ) : with shelve . open ( Constants . SONAR_DB_PATH ) as db : tools = db [ "tool" ] try : _dict = tools [ tool_name ] except KeyError : _dict = { "versions" : [ ] , "executable" : { } , "script" : { } } if version in _dict [ "versions" ] : logger . error ( "%s already exists. Use 'edit' to modify existing tools" , version , ) raise SonarInvalidOpError _dict [ "versions" ] . append ( version ) _dict [ "executable" ] [ "cad" ] = cad_exe _dict [ "executable" ] [ "hls" ] = hls_exe _dict [ "executable" ] [ "sim" ] = sim_exe _dict [ "script" ] [ version ] = script tools [ tool_name ] = _dict db [ "tool" ] = tools
Add a new tool to the database
Add a new tool to the database
"""
        Add a new tool to the database

        Args:
            tool_name (str): Name of the tool
            version (str): Tool version
            cad_exe (str): Name of CAD tool executable. None if not applicable
            hls_exe (str): Name of HLS tool executable. None if not applicable
            sim_exe (str): Name of simulation tool executable. None if not applicable
            script (str): Shell script to initialize the tool

        Raises:
            SonarInvalidOpError: Raised if attempting to add an already existing
                tool.
        """
Raised if attempting to add an already existing
tool.
Raised if attempting to add an already existing tool .
SonarInvalidOpError
tool_name
Name of the tool
Name of the tool
version
None
cad_exe
Name of CAD tool executable. None if not applicable
Name of CAD tool executable . None if not applicable
hls_exe
Name of HLS tool executable. None if not applicable
Name of HLS tool executable . None if not applicable
sim_exe
Name of simulation tool executable. None if not applicable
Name of simulation tool executable . None if not applicable
script
Shell script to initialize the tool
Shell script to initialize the tool