sonar/api.py
def one_time_setup(_args):
        """
        Performs initial setup for sonar. It creates the database, copies files
        over to the user sonar directory and adds the default boards to the
        database.

        Args:
            _args (object): Unused
        """
        sonar.database.init()

        src_dir = os.path.join(os.path.dirname(__file__), "files_to_copy/home")
        # dst_dir = os.path.join(Constants.SONAR_PATH)
        # need to use this copy tree instead of shutil because shutil copytree
        # expects the dst directory doesn't exist
        copy_tree(src_dir, str(Constants.SONAR_PATH))

        with open(Path.home().joinpath(".bashrc"), "r+") as f:
            for line in f:
                if "# added by sonar" in line:
                    break
            else:  # not found, we are at the eof
                f.write(
                    f"source {Constants.SONAR_SHELL_MAIN_SOURCE} # added by sonar"
                )
        files = os.listdir(os.path.join(os.path.dirname(__file__), "boards"))
        boards = [x for x in files if x not in ("__init__.py", "__pycache__")]
        for board in boards:
            path = os.path.join(os.path.dirname(__file__), "boards", board)
            sonar.database.Board.add(path)

        configure_logging()

        Performs initial setup for sonar. It creates the database, copies files
        over to the user sonar directory and adds the default boards to the
        database.

        Args:
            _args (object): Unused
        
Performs initial setup for sonar. It creates the database, copies files
over to the user sonar directory and adds the default boards to the
database.
Performs initial setup for sonar . It creates the database copies files over to the user sonar directory and adds the default boards to the database .
def one_time_setup(_args):
        sonar.database.init()
        src_dir = os.path.join(os.path.dirname(__file__), "files_to_copy/home")
        copy_tree(src_dir, str(Constants.SONAR_PATH))
        with open(Path.home().joinpath(".bashrc"), "r+") as f:
            for line in f:
                if "# added by sonar" in line:
                    break
            else:  
                f.write(
                    f"source {Constants.SONAR_SHELL_MAIN_SOURCE} # added by sonar"
                )
        files = os.listdir(os.path.join(os.path.dirname(__file__), "boards"))
        boards = [x for x in files if x not in ("__init__.py", "__pycache__")]
        for board in boards:
            path = os.path.join(os.path.dirname(__file__), "boards", board)
            sonar.database.Board.add(path)
        configure_logging()
def one_time_setup ( _args ) : sonar . database . init ( ) src_dir = os . path . join ( os . path . dirname ( __file__ ) , "files_to_copy/home" ) copy_tree ( src_dir , str ( Constants . SONAR_PATH ) ) with open ( Path . home ( ) . joinpath ( ".bashrc" ) , "r+" ) as f : for line in f : if "# added by sonar" in line : break else : f . write ( f"source {Constants.SONAR_SHELL_MAIN_SOURCE} # added by sonar" ) files = os . listdir ( os . path . join ( os . path . dirname ( __file__ ) , "boards" ) ) boards = [ x for x in files if x not in ( "__init__.py" , "__pycache__" ) ] for board in boards : path = os . path . join ( os . path . dirname ( __file__ ) , "boards" , board ) sonar . database . Board . add ( path ) configure_logging ( )
Performs initial setup for sonar.
Performs initial setup for sonar .
"""
        Performs initial setup for sonar. It creates the database, copies files
        over to the user sonar directory and adds the default boards to the
        database.

        Args:
            _args (object): Unused
        """ # dst_dir = os.path.join(Constants.SONAR_PATH) # need to use this copy tree instead of shutil because shutil copytree # expects the dst directory doesn't exist # not found, we are at the eof
_args
None