# -*- coding: utf-8 -*-
from waptpackage import PackageEntry
from setuphelpers import *
from setupdevhelpers import *
import json

def update_package():

    for entry in bs_find_all("https://wapt.tranquil.it/wapt/releases/latest/","a","href"):
        lnk = entry.attrs['href']
        if lnk.endswith('.deb'):
            if 'gui' in lnk:
                latest_bin = 'https://wapt.tranquil.it/wapt/releases/latest/' + lnk
                last_version = lnk.split('-')[3]


    wget(latest_bin,latest_bin.split('/')[-1])

    control.set_software_version(last_version)
    control.save_control_to_wapt()


