tis-projectlibre 1.7-1

  • package : tis-projectlibre
  • version : 1.7-1
  • description : OpenProj / ProjectLibre project management Ouvre fichiers msproject
  • maintainer : Tranquil IT Systems
  • date : 2017-10-11 11:06:32
  • signer : TRANQUIL IT SYSTEMS
  • signature_date : 20171011-110630
  • min_os_version :
  • min_wapt_version :
  • Depends :

setup.py

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

# registry key(s) where WAPT will find how to remove the application(s)
uninstallkey = []

software_name = "ProjectLibre"

def update_control(entry):
    # use last msi to get the version
    msi_list = glob.glob('*.msi')
    if msi_list:
        entry.version = get_msi_properties(msi_list[-1])['ProductVersion']

def install():
    # list all msi in package
    versionsoft = control['version'].split('-',1)[0]

    if iswin64():
        msi = "projectlibre-%s-x64.msi" % versionsoft
        install_msi_if_needed(msi,min_version=versionsoft,killbefore=['ProjectLibre'])
    else:
        msi = "projectlibre-%s.msi" % versionsoft
        install_msi_if_needed(msi,min_version=versionsoft,killbefore=['ProjectLibre'])


def session_setup():
    exe = makepath(programfiles32,'ProjectLibre','ProjectLibre.exe')
    create_programs_menu_shortcut('ProjectLibre',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 = "https://sourceforge.net/projects/projectlibre/files/ProjectLibre/?SetFreedomCookie"

    page = requests.get(base_url,headers={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; en-US; Win64; x64)'},verify=verify).text
    bs = BeautifulSoup.BeautifulSoup(page)
    bs_raw_string = str(bs.find('div',{'id':'files'}).find('div',{'class':'download-bar'}).find('strong').find('a',{'href':'/projects/projectlibre/files/latest/download?source=files'}).find('span').text)
    software_version = re.findall('Download projectlibre-(.*).msi *',str(bs_raw_string))[0]
    print software_version

    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 = "projectlibre-%s.msi" % software_version
        filename64 = "projectlibre-%s-x64.msi" % software_version

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

        print("Downloading latest version")
        download_url = 'https://freefr.dl.sourceforge.net/project/projectlibre/ProjectLibre/%s/projectlibre-%s.msi' % (software_version,software_version)
        download_url64 = 'https://freefr.dl.sourceforge.net/project/projectlibre/ProjectLibre/%s/projectlibre-%s-x64.msi' % (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"], ["projectlibre-1.7-x64.msi", "55263999bd74317b660c881058f285b9b2ea64a3"], ["projectlibre-1.7.msi", "7ff09367d9c467fe062007e58e358ea64766adad"], ["setup.py", "68e5279c72b004f1e173d3d79dffff394b0e7a47"], ["WAPT/control", "4d82c055b9caa09d8e4d72290671eac2d392ec2a"]]