tis-python3-32
3.9.4-22
Python is an interpreted, high-level, general-purpose programming language
6435 downloads

Description
- package : tis-python3-32
- version : 3.9.4-22
- architecture : all
- 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_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-04-12T11:21:09.006840
- 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/using/windows.html
# Defining variables
bin_name_string = 'python-%s.exe'
app_dir_name = 'Python%s-32'
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
page = requests.get(url, proxies=proxies).text
bs = BeautifulSoup.BeautifulSoup(page,features="html.parser")
bs_list = bs.findAll('a')
for vers in bs_list:
if vers.text.startswith('Latest Python 3 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 %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)
Changelog
Changelog software url : https://docs.python.org/3/whatsnew/changelog.html
No changelog.txt.