# -*- coding: utf-8 -*-
from setuphelpers import *
import glob
import tarfile

def install():
    mkdirs('/opt/python310/')
    f= glob.glob('*.tar.gz')[0]
    python_version = control.get_software_version()

    with tarfile.open(f, 'r:gz') as tar:
        tar.extractall(path='/opt/python310')
    # run('cd /opt/python310/ ; tar -xzf %s' % makepath(basedir,f))

def audit():
    python_version = run('/opt/python310/bin/python3 -V').split(' ')[1].strip()

    if Version(python_version) != control.get_software_version():
        print('version install : %s' % python_version)
        return "ERROR"
    else:
        return "OK"