tis-tortoisesvn 1.9.27038-21

  • package : tis-tortoisesvn
  • version : 1.9.27038-21
  • description : Outil de versioning SVN Subversion intégré à l'explorateur Windows (remarque: version 1.8.12 pour win 32 bits et win XP)
  • maintainer : TIS <technique@tranquil-it-systems.fr>
  • date : 2017-07-20 11:24:28
  • signer : TRANQUIL IT SYSTEMS
  • signature_date : 20170720-112428
  • min_os_version :
  • min_wapt_version :
  • Depends :

setup.py


from setuphelpers import *
import platform
import glob


uninstallkey = []

# additional options for msi install cusomization
msi_properties = {'ADDLOCAL':'CLI'}

def need_install(key,min_version=None,force=False):
    """Return True if the software with key can be found in uninstall registry
        and the registred version is equal or greater than min_version

    Args:
        key (str) : uninstall key
        min_version (str) : minimum version or None if don't check verion
    Returns:
        boolean

    """
    if force or not key:
        return True
    else:
        current = installed_softwares(uninstallkey=key)
        for soft in current:
            if not min_version or Version(soft['version']) >= Version(min_version):
                return False
        return True



def install_msi_if_needed(msi,min_version=None,killbefore=[],accept_returncodes=[0,1603,3010],timeout=300,properties={}):
    """Install silently the supplied msi file, and add the uninstall key to
    global uninstall key list

    uninstall key, min_version and silent flags are guessed from msi file.

    Raises an error if, after the msi install, the uninstall key is not found in registry.

    The matching is done on key

    Args:
        msi (str) : path to the MSI file
        min_version (str) : if installed version is equal or gretaer than this, don't install
                            if not provided, guess it from exe setup file properties.
        kill_before (list of str) : processes to kill before setup, to avoid file locks
                                    issues.
        accept_returncodes (list of int) : return codes which are acceptable and don't raise exception
        timeout int) : maximum run time of command in seconds bfore the child is killed and error is raised.
        properties (dict) : map (key=value) of properties for specific msi installation.

    Returns:
        None

    """
    if not isfile(msi):
        error('msi file %s not found in package' % msi)
    key = get_msi_properties(msi)['ProductCode']
    # will try to add key in the caller's (setup.py) uninstallkey list
    import inspect
    caller_globals = inspect.stack()[1][0].f_globals
    WAPT = caller_globals.get('WAPT',None)
    force = WAPT and WAPT.options.force

    if not min_version:
        min_version = getproductprops(msi)['version']

    if need_install(key,min_version=min_version,force=force):
        if killbefore:
            killalltasks(killbefore)
        props = ' '.join(["%s=%s" % (k,v) for (k,v) in properties.iteritems()])
        run(r'msiexec /norestart /q /i "%s" %s' % (msi,props),accept_returncodes=accept_returncodes,timeout=timeout)
        if not installed_softwares(uninstallkey=key):
            error('MSI %s has been installed but the uninstall key %s can not be found' % (msi,key))
    else:
        print('MSI %s already installed. Skipping msiexec' % msi)
    if key:
        if 'uninstallkey' in caller_globals and not key in caller_globals['uninstallkey']:
            caller_globals['uninstallkey'].append(key)


def find_msis(path=None):
    """Returns msi filename and properties"""
    if iswin64():
        if path is None:
            allmsi = glob.glob('*x64*.msi')
        else:
            allmsi = glob.glob(makepath(path,'*x64*.msi'))
    else:
        if path is None:
            allmsi = glob.glob('*win32*.msi')
        else:
            allmsi = glob.glob(makepath(path,'*win32*.msi'))

    result = []
    for msi in allmsi:
        # uninstallkey is in msi db
        props = get_msi_properties(msi)
        result.append((msi,props))
    return result


def update_control(entry):
    """Magic Callback to update control version data at build step"""
    (version,packaging) = entry.version.split('-',1)
    msis = find_msis()
    # use first msi's version for the package version
    version = msis[0][1]['ProductVersion']
    entry.version = "%s-%s"%(version,packaging)


def install():
    killalltasks(['TortoiseProc.exe','TSVNCache.exe'])


    # calc package prefix from current package name
    default_prefix = control.package.split('-',1)[0]
    msi45_package = '%s-msi-4.5'%default_prefix

    # tortoisesvn installer requires newest version of msi on Windows XP
    if platform.win32_ver()[0] == 'XP' and not installed_softwares('KB942288-v3'):
        if WAPT.is_available(msi45_package):
            WAPT.install(msi45_package)
        else:
            Exception('%s is not avaible'%msi45_package)


    msis = find_msis()
    for (msi,props) in msis:
        install_msi_if_needed(msi,properties=msi_properties)

    # silent install does not install any icons set for some reason
    for (msi,props) in find_msis('TortoiseOverlays'):
        install_msi_if_needed(msi)
    

manifest

[["WAPT/icon.png", "ff80f8adb7559ee51430dde56236392438a556bf"], ["TortoiseSVN-1.8.12.26645-win32-svn-1.8.14.msi", "5caa4cf8c30c2ced5a439016a7f43b309bf83293"], ["WAPT/wapt.psproj", "d140401965341ede69880cd6342c5db7040324b2"], ["WAPT/certificate.crt", "0db563dc9077b268ca07ba834322d0fc5e21f8e5"], ["msioptions.txt", "8e7ecf814e9829a7b188b7fe01eb3fc428325832"], ["TortoiseOverlays/TortoiseOverlays-1.1.4.26626-win32.msi", "04a8517436aff786d4d2fdd670d9a2c0e7b1aa69"], ["TortoiseOverlays/TortoiseOverlays-1.1.4.26626-x64.msi", "664f9f62f63412d6abf8c41c775550763a474649"], ["TortoiseOverlays/TortoiseOverlays-1.1.4.26626-win32.msm", "edb2c6ec693c92a5a526094327d75c88d2f9394e"], ["TortoiseOverlays/TortoiseOverlays-1.1.4.26626-x64.msm", "1f66e27ee5c269aa3406ecebff90bf3b88cbbc11"], ["setup.py", "f5d93f33c69c635949759d760325ebc047d6feb7"], ["TortoiseSVN-1.9.3.27038-x64-svn-1.9.3.msi", "8005189f252f806f593a497a7cf85864751f1162"], ["WAPT/control", "a12c6957cfb35f7951634a3c4651972c5be6d11a"]]