# -*- coding: utf-8 -*-
"""
/***************************************************************************
 RAVI
                                 A QGIS plugin
 DEM
 Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
                             -------------------
        begin                : 2026-04-01
        copyright            : (C) 2026 by FARM Analytica
        email                : livia.scopel@farmanalytica.com.br
        git sha              : $Format:%H$
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
 This script initializes the plugin, making it known to QGIS.
"""

import os
import sys

_plugin_dir = os.path.dirname(__file__)
_extlibs_path = os.path.join(_plugin_dir, "extlibs")

if os.path.isdir(_extlibs_path) and _extlibs_path not in sys.path:
    sys.path.insert(0, _extlibs_path)


def classFactory(interface):
    from . import extlibs_manager
    # Provision (or re-provision after a QGIS Python upgrade) the deps matching
    # the running interpreter; tag-aware so a stale build triggers a refresh.
    if extlibs_manager.needs_provision():
        extlibs_manager.start_download()

    from .farm_tools import FarmTools
    return FarmTools(interface)
