tis-python38

3.8.7-10
Python is an interpreted, high-level, general-purpose programming language
264 downloads
Download

  Description 

  • package : tis-python38
  • version : 3.8.7-10
  • architecture : x86
  • categories : Development
  • maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ
  • description : Python is an interpreted, high-level, general-purpose programming language
  • locale : all
  • target_os : windows
  • min_os_version : 6.0
  • max_os_version :
  • min_wapt_version : 1.7
  • 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 :
  • description_de :
  • description_es :
  • description_pt :
  • description_it :
  • description_nl :
  • description_ru :
  • editor : Python Software Foundation
  • licence : Python Software Foundation License
  • signature_date : 2021-01-08T11:06:10.233052
  • Homepage : https://www.python.org/
  • Depends :
  • Conflicts :

  Setup.py 

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

uninstallkey = []

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

# Defining variables
bin_name_string = 'python-%s.exe'
app_dir_name = 'Python%s'
app_dir_string = makepath(programfiles32,app_dir_name) # Make sure to use programfiles32 for 32-Bits version and programfiles64 for 64-Bits version
silent_args_string = '/quiet InstallAllUsers=1 PrependPath=1 AssociateFiles=1 Include_launcher=0 InstallLauncherAllUsers=0 TargetDir="%s"' % app_dir_string
silent_uninst_args = '/uninstall /quiet'
app_uninstallkey = '' # Let it empty because it change every versions
whl_dir = 'whl'


def install():
    # Initializing variables
    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 = bin_name_string % package_version
    app_dir = app_dir_string % short_version
    app_installer_path = makepath(app_dir,bin_name)
    whl_dir_path = makepath(basedir,whl_dir)
    product_name = get_file_properties(bin_name)['ProductName']
    silent_args = silent_args_string % short_version

    # Installing the package
    print("Installing %s to: %s" % (product_name,app_dir))
    install_exe_if_needed(bin_name,
        silentflags=silent_args,
        key=app_uninstallkey,
        min_version=package_version)

    # Copying installer for future uninstall
    if not isfile(app_installer_path):
        filecopyto(bin_name,app_installer_path)

    # Prevent interaction with waptpython (please make sure that the following code require the defined path)
    if "PYTHONHOME" 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))

    # Rolling back WAPT Python Pathes (will ensure that WAPT install complete correctly)
    if "PYTHONHOME" in os.environ.keys():
        del os.environ["PYTHONHOME"]
    if "PYTHONPATH" in os.environ.keys():
        del os.environ["PYTHONPATH"]
    os.environ["PYTHONHOME"] = makepath(programfiles32, 'wapt')
    os.environ["PYTHONPATH"] = makepath(programfiles32, 'wapt')


def uninstall():
    # Initializing variables
    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 = bin_name_string % package_version
    app_dir = app_dir_string % short_version
    app_installer_path = makepath(app_dir,bin_name)

    # Uninstalling the package
    run('"%s" %s' % (app_installer_path,silent_uninst_args))

    # 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))

    # Removing system environment variables
    remove_from_system_path(app_dir)
    remove_from_system_path(makepath(app_dir, 'Scripts'))


def update_package():
    # Initializing variables
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    app_name = control.name
    url = control.sources

    # Getting latest version from official sources
    for bs_search in bs_find_all(url, 'a', proxies=proxies):
        if bs_search.text.startswith('Python 3.8.'):
            version = bs_search.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 %s version is: %s" % (app_name, version))
    print("Download url is: %s" % url_dl)

    # Downloading latest binaries
    if not isfile(latest_bin):
        print('Downloading: %s' % latest_bin)
        wget(url_dl, latest_bin, proxies=proxies)

        # Checking version from file
        version_from_file = get_file_properties(latest_bin)['ProductName'].split(' (')[0].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
        control.version = '%s-%s' % (version, int(control.version.split('-')[-1])+1)
        control.save_control_to_wapt()
        print("Changing package version to: %s in WAPT\\control" % control.version)

    # Deleting outdated binaries
    remove_outdated_binaries(version)

    # Getting latest Python PIP
    page = requests.get('https://pypi.org/project/pip/#files', proxies=proxies).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=proxies)




def get_proxies():
    if platform.python_version_tuple()[0] == '3':
        from urllib.request import getproxies
    else:
        from urllib import getproxies
    return getproxies()


def get_proxies_from_wapt_console():
    proxies = {}
    if platform.system() == 'Windows':
        waptconsole_ini_path = makepath(user_local_appdata(), 'waptconsole', 'waptconsole.ini')
    else:
        waptconsole_ini_path = makepath(user_home_directory(), '.config', 'waptconsole', 'waptconsole.ini')
    if isfile(waptconsole_ini_path):
        proxy_wapt = inifile_readstring(waptconsole_ini_path, 'global', 'http_proxy')
        if proxy_wapt:
            proxies = {'http': proxy_wapt, 'https': proxy_wapt}
    return proxies


def get_version_from_binary(filename, parameter='ProductVersion'):
    if filename.endswith('.msi'):
        return get_msi_properties(filename)[parameter]
    else:
        return get_file_properties(filename)[parameter]


def remove_outdated_binaries(version, list_extensions=['exe','msi','deb','rpm','dmg','pkg'], list_filename_contain=None):
    if type(list_extensions) != list:
        list_extensions = [list_extensions]
    if list_filename_contain:
        if type(list_filename_contain) != list:
            list_filename_contain = [list_filename_contain]
    list_extensions = ['.' + ext for ext in list_extensions if ext[0] != '.']
    for file_ext in list_extensions:
        for bin_in_dir in glob.glob('*%s' % file_ext):
            if not version in bin_in_dir:
                remove_file(bin_in_dir)
            if list_filename_contain:
                for filename_contain in list_filename_contain:
                    if not filename_contain in bin_in_dir:
                        remove_file(bin_in_dir)


def bs_find_all(url, element, attribute=None, value=None, headers=None, proxies=None, features='html.parser', **kwargs):
    """"You may need to use a header for some websites. For example: headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0'}
    """
    import requests
    page = requests.get(url, proxies=proxies, headers=headers, **kwargs).text
    try:
        import bs4 as BeautifulSoup
        soup = BeautifulSoup.BeautifulSoup(page, features=features)
    except:
        import BeautifulSoup
        soup = BeautifulSoup.BeautifulSoup(page)
    if value:
        return soup.findAll(element,{attribute:value})
    else:
        return soup.findAll(element)


										

  Changelog 


Changelog software url : https://docs.python.org/3.8/whatsnew/changelog.html

No changelog
  manifest.sha256 
[["python-3.8.7.exe","6dba69e974634ad1eebdc289c78ab48970913e93c81dec90635963abd6555370"],["setup.py","d7cc274e81b66e637d41390a682e1a64655d174fe2b844c406f65592d754f515"],["WAPT/certificate.crt","a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf"],["WAPT/icon.png","b55b23fa81945c6cd4c2f4f114188aa9f8f3d0c3cbb9fb353b2803ffbb67b43b"],["whl/pip-20.3.3-py2.py3-none-any.whl","fab098c8a1758295dd9f57413c199f23571e8fde6cc39c22c78c961b4ac6286d"],["WAPT/control","ed36843f0fefcde8cf4dd38ee47a0899cbfa7414e9ec879b616c4ad5b021805e"]]