def pixo_rigging_startup():

    print ''
    print( "="*120 )
    print( "Installing Pixo Rigging Toolset..." )
    print( "="*120 )
    
    config_path = pm.mel.getenv('PIXO_RIGGING_CONFIG_PATH')
    if not os.path.exists(config_path):
        directory_browser_launch()
        return
  
    with open(config_path, 'r') as f:
        config_data = json.load(f)
        root_path = config_data["PIXO_RIGGING_ROOT_PATH"]
     
    if os.path.exists(root_path):    
        if not root_path in sys.path:
            print( "Appending %s To sys.path" %root_path )
            sys.path.append(root_path)
            
    try:
        print("Root Path = %s"%root_path)
        import system.init_setup as init_setup; reload(init_setup)
        init_setup.main()

        print( "="*120 )        
        print( "Installed Pixo Rigging Toolset Successfully..." )
        print( "="*120 )        
        
    except Exception, e:
        print ( "" )
        print( "="*120 )
        logger.error('Failed To Install Pixo Rigging Toolset', exc_info=True)
        print( "="*120 )
def afok_toolset_install(root_path):
    """
        - Append all child folders under the SCRIPT_FOLDER to sys.path
        - Import and install toolset
    """
    logger.debug("Function (%s)"%inspect.stack()[0][3])
    
    if os.path.exists(root_path):    
        if not root_path in sys.path:
            logger.info( "Appending %s to sys.path" %root_path )
            sys.path.append(root_path)
            
    #run setup
    try:
        import system.init_setup as init_setup; reload(init_setup)
        init_setup.main()
        
    except Exception, e:
        logger.error('Failed to install afok_toolset', exc_info=True)