#!/usr/bin/python3
# Alterator service for Samba Active Directory
#
# Copyright (C) 2024 Evgenii Sozonov <arzdez@altlinux.org>
#
# 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 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>

import sys
import sysconfig
from pathlib import Path

platlib = Path(sysconfig.get_path("platlib"))
samba_dc_path = (
    platlib.parents[1]
    / "samba-dc"
    / f"python{sys.version_info.major}.{sys.version_info.minor}"
)
if not samba_dc_path.is_dir():
    raise RuntimeError(f"Samba DC Python modules not found: {samba_dc_path}")
sys.path.insert(0, str(samba_dc_path))

from alterator_service_samba_ad.cli import main  # noqa: E402

if __name__ == "__main__":
    sys.exit(main())
