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

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

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

def audit():
    python_version = run('/opt/wapt/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"