tis-python38

3.8.6-3
Python is an interpreted, high-level, general-purpose programming language
1164 downloads
Download

  Description 

  • package : tis-python38
  • version : 3.8.6-3
  • architecture : x64
  • categories : Development
  • maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ
  • description : Python is an interpreted, high-level, general-purpose programming language
  • locale :
  • target_os : windows
  • 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 : 2020-11-23T10:46:35.102287
  • Homepage : https://www.python.org/
  • Depends :

  Setup.py 

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

uninstallkey = []

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

# Defining variables
bin_name_string = 'python-%s-amd64.exe'
app_dir_name = 'Python%s'
app_dir_string = makepath(programfiles64,app_dir_name) # Make sure to use programfiles32 for 32-Bits version and programfiles64 for 64-Bits version
app_uninstallkey = '' # Let it empty because it change every versions
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'
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']

    # Installing the package
    print("Installing %s to: %s" % (product_name,app_dir))
    install_exe_if_needed(bin_name,
        silentflags=silent_args_string % short_version,
        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.split('\\')[-1])
        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():
    # 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 = 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))


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

    # Initializing variables
    proxies = get_proxies()
    app_name = control.name
    url = control.sources

    # Getting latest version from official website
    for bs_search in bs_find_all(url, 'a', proxies=proxies, user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0'):
        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',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=proxies)




def bs_find(url, element, attribute=None, value=None, user_agent=None, proxies=None, features='html.parser', **kwargs):
    """"You may need to use a user agent for some websites.
    Example: user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0')
    """
    if user_agent:
        page = requests.get(url, proxies=proxies, headers={'User-Agent':'%s' % user_agent}, **kwargs).text
    else:
        page = requests.get(url, proxies=proxies, **kwargs).text
    soup = BeautifulSoup.BeautifulSoup(page, features=features)
    if value:
        return soup.find(element, {attribute: value})
    else:
        return soup.find(element)


def bs_find_all(url, element, attribute=None, value=None, user_agent=None, proxies=None, features='html.parser', **kwargs):
    """"You may need to use a user agent for some websites.
    Example: user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0')
    """
    if user_agent:
        page = requests.get(url, proxies=proxies, headers={'User-Agent':'%s' % user_agent}, **kwargs).text
    else:
        page = requests.get(url, proxies=proxies, **kwargs).text
    soup = BeautifulSoup.BeautifulSoup(page, features=features)
    if value:
        return soup.find_all(element, {attribute:value})
    else:
        return soup.find_all(element)


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 get_proxies():
    import platform
    if platform.python_version_tuple()[0] == '3':
        from urllib.request import getproxies
    else:
        from urllib import getproxies
    return getproxies()

										

  Changelog 



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



No changelog.txt.
									
  manifest.sha256