# -*- coding: utf-8 -*-
from setuphelpers import *
from setupdevhelpers import *
import os


def update_package():
    install_apt('python3-pip')
    install_apt('git')
    run(fr'git clone https://gitea.ad.tranquil.it/doc/doc-wapt.git /tmp/doc-wapt')

    os.chdir('/tmp/doc-wapt')

    run("make clean")
    run("rm -Rf ./build/")
    run("pip3 install -U setuptools --break-system-packages")
    run("pip3 install -r requirements.txt --upgrade --break-system-packages")
    run("make gettext")
    run("sphinx-intl update -p build/locale/ -l fr")
    run("make clean")
    run("make htmlen")
    run('make -e SPHINXOPTS="-D language=\'fr\'" htmlfr')

    os.chdir(basedir)

    copytree2('/tmp/doc-wapt/build','build')
