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

Description
- package : tis-python3-32
- version : 3.9.1-18
- architecture : all
- 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-12-16T19:15:40.724785
- Homepage : https://www.python.org/
- Depends :
Setup.py
# -*- coding: utf-8 -*-
from setuphelpers import *
import requests
import platform
try:
import bs4 as BeautifulSoup
except:
import BeautifulSoup
uninstallkey = []
# Installation procedure: https://docs.python.org/3/using/windows.html
# Declaring specific app values (TO CHANGE)
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():
# 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)
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)
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')
# 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)'},proxies=proxy).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 ' + 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_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
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)'},proxies=proxy).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)
Changelog
Changelog software url : https://docs.python.org/3/whatsnew/changelog.html
No changelog.txt.