tis-python2 icon

Python 2.x

Silent install package for Python 2.x

2.7.18-16

  • package: tis-python2
  • name: Python 2.x
  • version: 2.7.18-16
  • categories: Development
  • maintainer: WAPT Team,Tranquil IT,Jimmy PELÉ,Pierre Cosson
  • editor: Python Software Foundation
  • licence: Python Software Foundation License
  • locale: all
  • target_os: windows
  • architecture: x86
  • signature_date:
  • size: 19.06 Mo
  • homepage : https://www.python.org/
  • depends:
  • conflicts :

package           : tis-python2
version           : 2.7.18-16
architecture      : x86
section           : base
priority          : optional
name              : Python 2.x
categories        : Development
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ,Pierre Cosson
description       : Python is an interpreted, high-level, general-purpose programming language
depends           : tis-vcredist
conflicts         : tis-python2-32
maturity          : PROD
locale            : all
target_os         : windows
min_wapt_version  : 2.0
sources           : https://www.python.org/downloads/windows/
installed_size    : 
impacted_process  : 
description_fr    : Python est un langage de programmation interprété, multi-paradigme et multiplateformes
description_pl    : Python jest interpretowanym, wysokopoziomowym językiem programowania ogólnego przeznaczenia
description_de    : Python ist eine interpretierte Hochsprachenprogrammiersprache für allgemeine Zwecke
description_es    : Python es un lenguaje de programación interpretado, de alto nivel y de propósito general
description_pt    : Python é uma linguagem de programação interpretada, de alto nível, de uso geral
description_it    : Python è un linguaggio di programmazione interpretato, di alto livello e di uso generale
description_nl    : Python is een geïnterpreteerde, algemene programmeertaal op hoog niveau
description_ru    : Python - интерпретируемый, высокоуровневый язык программирования общего назначения
audit_schedule    : 
editor            : Python Software Foundation
keywords          : python,2,2.7,programming,language,interpreted,py,.py,code,coding,language,object-oriented
licence           : Python Software Foundation License
homepage          : https://www.python.org/
package_uuid      : 9a596627-9d09-4e89-ad78-b46551099101
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : https://docs.python.org/2.7/whatsnew/2.7.html
min_os_version    : 6.0
max_os_version    : 
icon_sha256sum    : b55b23fa81945c6cd4c2f4f114188aa9f8f3d0c3cbb9fb353b2803ffbb67b43b
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature         : F5KEf/YCwUUJP8ogpG99lnRKV7R5DTX26ZnvGOOgo6xhfj0WgcydVCETrbyLdG5URNAJRSF436tVb2IVyChhxe7XD/Gt/loxzkpM3hX9d5QQMFgUizHCLm0szvrtBEI7yr36SCKzikgLCfkqKX73KnrqckGDrbLGeFuzj0G5w5cX3eBwsBOGFd9+NkxQS50tX1YXG27raPKnyeWnz6Podt5TzjKp4Eij4ST2zxx09rkmOSZ0mL97xdb5z8B4q1cytgCyyKA2cSvHgjVVy6zFnxn04tXHIkvpYcqGAHMLWZfrPq8+PozFkbSoCpeBYzSXr0eEkgeT+D0VgMln4uMoyw==
signature_date    : 2022-08-02T03:02:02.525861
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes

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

# Installation procedure: https://docs.python.org/2/using/windows.html

# Declaring specific app values (TO CHANGE)
app_dir_string = makepath(programfiles32, "Python%s")  # Make sure to use programfiles32 for 32-Bits version and programfiles64 for 64-Bits version
# whl_dir = 'whl'


def install():
    # Specific app values
    package_version = control.version.split("-", 1)[0]
    package_version_split = package_version.split(".")
    short_version = "%s%s" % (package_version_split[0], package_version_split[1])
    bin_name = "python-%s.msi" % package_version
    app_dir = app_dir_string % short_version
    silent_args_string = {"ALLUSERS": 1, "ADDLOCAL": "ALL", "TargetDir": '"%s"' % app_dir}
    # whl_dir_path = makepath(basedir,whl_dir)

    # Installing the package
    print("Installing Python %s to: %s" % (package_version, app_dir))
    install_msi_if_needed(
        bin_name,
        properties=silent_args_string,
        min_version=package_version,
    )

    # Prevent interaction with waptpython Wheels
    if "PYTHOHOME" in os.environ.keys():
        del os.environ["PYTHONHOME"]
    if "PYTHONPATH" in os.environ.keys():
        del os.environ["PYTHONPATH"]
    os.environ["PYTHONPATH"] = app_dir
    os.environ["PYTHONHOME"] = app_dir

    # # Installing Python Wheels
    # for whl in glob.glob(r'%s\*.whl' % whl_dir_path):
    #     print('Installing Python Wheel: %s' % whl)
    #     run(r'"%s\Scripts\easy_install.exe" "%s"' % (app_dir,whl))


def uninstall():
    # Specific app values
    package_version = control.version.split("-", 1)[0]
    package_version_split = package_version.split(".")
    short_version = "%s%s" % (package_version_split[0], package_version_split[1])
    app_dir = app_dir_string % short_version

    # Removing remaining files of this Python version
    try:
        if isdir(app_dir):
            print("Removing remaining folder: %s" % app_dir)
            remove_tree(app_dir)
    except:
        print("Unable to remove Python %s remaining folder: %s" % (package_version, app_dir))

# -*- coding: utf-8 -*-
from setuphelpers import *
import requests
import platform
import bs4 as BeautifulSoup

# Installation procedure: https://docs.python.org/2/using/windows.html

# Declaring specific app values (TO CHANGE)
bin_name_string = "python-%s.msi"


def update_package():
    print("Download/Update package content from upstream binary sources")

    # Getting proxy informations from WAPT settings
    proxy = {}
    if platform.system() == "Windows" and isfile(makepath(user_local_appdata(), "waptconsole", "waptconsole.ini")):
        proxywapt = inifile_readstring(makepath(user_local_appdata(), "waptconsole", "waptconsole.ini"), "global", "http_proxy")
        if proxywapt:
            proxy = {"http": proxywapt, "https": proxywapt}

    # Specific app values
    app_name = control.name
    url = control.sources

    # Getting latest version from official website
    page = requests.get(url, headers={"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64)"}).text
    bs = BeautifulSoup.BeautifulSoup(page, features="html.parser")
    bs_list = bs.findAll("a")
    for vers in bs_list:
        if vers.text.startswith("Latest Python 2 Release"):
            version = vers.text.split(" ")[-1]
            break

    latest_bin = bin_name_string % version
    url_dl = "https://www.python.org/ftp/python/%s/%s" % (version, latest_bin)

    print("Latest " + app_name + " version is: " + version)
    print("Download url is: " + url_dl)

    # Downloading latest binaries
    if not isfile(latest_bin):
        print("Downloading: " + latest_bin)
        wget(url_dl, latest_bin, proxies=proxy)

        # Checking version from file
        version_from_file = get_msi_properties(latest_bin)["ProductName"].split(" ")[1]
        if version != version_from_file and version_from_file != "":
            version = version_from_file
            old_latest_bin = latest_bin
            latest_bin = bin_name_string % version
            if isfile(latest_bin):
                remove_file(latest_bin)
            os.rename(old_latest_bin, latest_bin)

        # Changing version of the package
        pe = PackageEntry().load_control_from_wapt(".")
        pe.version = "%s-%s" % (version, int(pe.version.split("-", 1)[1]) + 1)
        pe.save_control_to_wapt(".")
        print("Changing version to " + pe.version + " in WAPT\\control")
        print("Update package done. You can now build-upload your package")
    else:
        print("This package is already up-to-date")

    # # Getting latest Python PIP
    # page = requests.get('https://pypi.org/project/pip/#files',headers={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'}).text
    # bs = BeautifulSoup.BeautifulSoup(page,features="html.parser")
    # url_dl_pip = bs.find('span',{'class':'table__mobile-label'}).find_next()['href']
    # latest_bin_pip = url_dl_pip.split('/')[-1]
    # if not isfile(latest_bin_pip):
    #     print('Downloading: ' + latest_bin_pip)
    #     wget(url_dl_pip,makepath(whl_dir,latest_bin_pip),proxies=proxy)

    # Deleting outdated binaries
    for bin_in_dir in glob.glob("*.exe") or glob.glob("*.msi") or glob.glob("*.zip"):
        if bin_in_dir != latest_bin:
            print("Outdated binary: " + bin_in_dir + " Deleted")
            remove_file(bin_in_dir)

1540d0d954b22697c85fd0582961fba2602cedc9ef363590edecf5d2c957cc64 : setup.py
c323995056a5e762b8e8d9e6ed282251a4fe5a905604d3f41d04e51cedc3f7aa : update_package.py
d901802e90026e9bad76b8a81f8dd7e43c7d7e8269d9281c9e9df7a9c40480a9 : python-2.7.18.msi
b55b23fa81945c6cd4c2f4f114188aa9f8f3d0c3cbb9fb353b2803ffbb67b43b : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
042865de741e5c6f61fe9e9adc57e69389878dd8172b40c149de4b3f6c416c65 : luti.json
d8bbd12f1b2c42da656665dd50ae726a8cf4f9f76ba9e31c914e07452eff9dd0 : WAPT/control