tis-python2-32
2.7.18-26
Python is an interpreted, high-level, general-purpose programming language
1217 downloads
View on


Description
- package : tis-python2-32
- version : 2.7.18-26
- 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.5
- 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 : 2022-04-26T04:07:55.275182
- Homepage : https://www.python.org/
- Depends :
- Conflicts :
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/2/using/windows.html
# Declaring specific app values (TO CHANGE)
bin_name_string = "python-%s.msi"
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
# 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
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 (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])
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))
# Removing sys env variables
remove_from_system_path(app_dir)
remove_from_system_path(makepath(app_dir, "Scripts"))
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
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)
# # 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)
Changelog
Changelog software url : https://docs.python.org/2.7/whatsnew/2.7.html
No changelog.txt.