tis-dotnetfx3.5 3.5.30729-9

  • package : tis-dotnetfx3.5
  • version : 3.5.30729-9
  • description : dot net framework 3.5
  • maintainer : TIS <technique@tranquil-it-systems.fr>
  • date : 2017-07-20 11:19:51
  • signer : TRANQUIL IT SYSTEMS
  • signature_date : 20170720-111949
  • min_os_version :
  • min_wapt_version :

setup.py

#!/usr/bin/python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------
#    This file is part of WAPT
#    Copyright (C) 2013  Tranquil IT Systems http://www.tranquil.it
#    WAPT aims to help Windows systems administrators to deploy
#    setup and update applications on users PC.
#
#    WAPT is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    WAPT is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with WAPT.  If not, see <http://www.gnu.org/licenses/>.
#
# -----------------------------------------------------------------------

import platform
from setuphelpers import *
import types
import re

uninstallkey = []
uninstallstring= []

class Version(object):
    """Version object of form 0.0.0
        can compare with respect to natural numbering and not alphabetical

    >>> Version('0.10.2') > Version('0.2.5')
    True
    >>> Version('0.1.2') < Version('0.2.5')
    True
    >>> Version('0.1.2') == Version('0.1.2')
    True
    """

    def __init__(self,version,members_count=None):
        if version is None:
            version = ''
        assert isinstance(version,types.ModuleType) or isinstance(version,str) or isinstance(version,unicode) or isinstance(version,Version)
        if isinstance(version,types.ModuleType):
            self.versionstring = version.__version__
        elif isinstance(version,Version):
            self.versionstring = version.versionstring
        else:
            self.versionstring = version
        self.members = [ v.strip() for v in self.versionstring.split('.')]
        if members_count is not None:
            if len(self.members)<members_count:
                self.members.extend(['0'] * (members_count-len(self.members)))
            else:
                del self.members[members_count:]

    def __cmp__(self,aversion):
        def nat_cmp(a, b):
            a = a or ''
            b = b or ''

            def convert(text):
                if text.isdigit():
                    return int(text)
                else:
                    return text.lower()

            def alphanum_key(key):
                return [convert(c) for c in re.split('([0-9]+)', key)]

            return cmp(alphanum_key(a), alphanum_key(b))

        if not isinstance(aversion,Version):
            aversion = Version(aversion)
        for i in range(0,min([len(self.members),len(aversion.members)])):
            i1,i2  = self.members[i], aversion.members[i]
            v = nat_cmp(i1,i2)
            if v:
                return v
        return 0

    def __str__(self):
        return '.'.join(self.members)

    def __repr__(self):
        return "Version('{}')".format('.'.join(self.members))

def windows_version():
    """see https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx"""
    try:
        return Version(platform.win32_ver()[1],3)
    except:
        return Version(platform.win32_ver()[1])

# https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx
# https://msdn.microsoft.com/en-us/library/windows/desktop/dn481241(v=vs.85).aspx
Windows10 = Version('10.0',2)
WindowsServer2016TechnicalPreview = Version('10.0',2)

Windows81 = Version('6.3',2)
WindowsServer2012R2 = Version('6.3',2)

Windows8 = Version('6.2',2)
WindowsServer2012 = Version('6.2',2)

Windows7 = Version('6.1',2)
WindowsServer2008R2 = Version('6.1',2)

WindowsServer2008 = Version('6.0',2)
WindowsVista = Version('6.0',2)

WindowsServer2003R2 = Version('5.2',2)
WindowsServer2003 = Version('5.2',2)
WindowsXP64 = Version('5.2',2)

WindowsEmbeddedStandard2009 = WindowsXP = Version('5.1',2)
WindowsXP = Version('5.1',2)

Windows2000 = Version('5.0',2)


def install():
    dotnet35 = [ s for s in installed_softwares('Microsoft .NET Framework 3.5') if Version(s['version']) >= Version('3.5.30729')]

    #on windows 2008R2, dotnetfx3.5 is installed as a "feature" and cannot be installed with a separate download file.
    if windows_version() >= Version('6.1',2):
        # direct call gives a segmentation fault... so using cmd.exe indirect
        with disable_file_system_redirection():
            run(r'dism.exe /online /enable-feature /featurename:NetFx3')
    elif not dotnet35:
        print run('dotnetfx35.exe /q /norestart')
        uninstallkey.append('{CE2CDD62-0124-36CA-84D3-9F4DCF5C5BD9}')
        print("After install, restart your computer is recommended.")
    else:
        uninstallkey.append('{CE2CDD62-0124-36CA-84D3-9F4DCF5C5BD9}')

def uninstall():
    for key in ['{CE2CDD62-0124-36CA-84D3-9F4DCF5C5BD9}',
        '{0BD83598-C2EF-3343-847B-7D2E84599128}',
        '{C09FB3CD-3D0C-3F2D-899A-6A1D67F2073F}',
        '{A3051CD0-2F64-3813-A88D-B8DCCDE8F8C7}',
        '{72AD53CC-CCC0-3757-8480-9EE176866A7C}',
        '{3E31821C-7917-367E-938E-E65FC413EA31}']:
            run_notfatal('msiexec /qn /X%s'%key)

    

manifest

[["setup.py", "3b5f3f9d10dccb08934688cd12d9c9f4443f9827"], ["WAPT/certificate.crt", "0db563dc9077b268ca07ba834322d0fc5e21f8e5"], ["dotnetfx35.exe", "3dce66bae0dd71284ac7a971baed07030a186918"], ["WAPT/wapt.psproj", "fd220f992290e136b50a261467611b72aa54b4ff"], ["WAPT/control", "09824733349c1991e850cf0e3a6d615162d408ff"]]