tis-ultradefrag 7.0.2-1

  • package : tis-ultradefrag
  • version : 7.0.2-1
  • description : Ultradefrag: Utilitaire de defragmentation
  • maintainer : Tranquil IT Systems
  • date : 2017-10-11 11:07:08
  • signer : TRANQUIL IT SYSTEMS
  • signature_date : 20171011-110708
  • min_os_version :
  • min_wapt_version :

setup.py

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

uninstallkey = []

software_name = "UltraDefrag"

def install():
    print('installing %s' % software_name)
    versionsoft = control['version'].split('-',1)[0]
    if iswin64():
        install_exe_if_needed("ultradefrag-%s.bin.amd64.exe" % versionsoft,"/S",key="UltraDefrag",min_version=versionsoft,killbefore='ultradefrag.exe')
    else:
        install_exe_if_needed("ultradefrag-%s.bin.i386.exe" % versionsoft,"/S",key="UltraDefrag",min_version=versionsoft,killbefore='ultradefrag.exe')


def update_package():
    import BeautifulSoup,requests,re
    from waptpackage import PackageEntry
    verify=True
    pe = PackageEntry()
    pe.load_control_from_wapt(os.getcwd())
    current_version = pe['version'].split('-',1)[0]

    base_url = "http://ultradefrag.sourceforge.net/en/index.html?download"

    page = requests.get(base_url,headers={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'},verify=verify).text
    bs = BeautifulSoup.BeautifulSoup(page)
    bs_raw_string = str(bs.find('div',{'class':'mpart'}).find('h2').find('strong').text)
    software_version = re.findall('STABLE RELEASE (.*)',str(bs_raw_string))[0]

    print "Current %s WAPT package version is : %s" % (software_name,current_version)
    print "Latest %s version available is : %s" % (software_name,software_version)

    if Version(current_version) < Version(software_version):
        print("%s package is not up-to-date, updating" % software_name)
        print("Cleanup current files")

        filename = "ultradefrag-%s.bin.i386.exe" % software_version
        filename64 = "ultradefrag-%s.bin.amd64.exe" % software_version

        for exe in glob.glob('*.exe'):
            if exe not in {filename,filename64}:
                remove_file(exe)

        print("Downloading latest version")
        download_url = 'https://freefr.dl.sourceforge.net/project/ultradefrag/stable-release/%s/ultradefrag-%s.bin.i386.exe' % (software_version,software_version)
        download_url64 = 'https://freefr.dl.sourceforge.net/project/ultradefrag/stable-release/%s/ultradefrag-%s.bin.amd64.exe' % (software_version,software_version)
        wget(download_url,filename)
        wget(download_url64,filename64)

        pe.version = software_version + '-0'
        pe.save_control_to_wapt(os.getcwd())
    else:
        print("No update needed, package already up to date")

if __name__ == "__main__":
    update_package()
    

manifest

[["WAPT/certificate.crt", "0db563dc9077b268ca07ba834322d0fc5e21f8e5"], ["WAPT/wapt.psproj", "557e60050809687d56525e6ac46df9c0e02ccae6"], ["ultradefrag-7.0.2.bin.amd64.exe", "b01d69f1be4958da6d2e76c777677e448b86ac12"], ["ultradefrag-7.0.2.bin.i386.exe", "f65ab148891fe5a21a51bb94f4f3b4c663e754f8"], ["setup.py", "95e3e499f889592f819b6432a6c783affc048a22"], ["WAPT/control", "7fa361ce8481c52c267aae814d765090bcf778a7"]]