tis-wapt-python311-relocatable icon

tis-wapt-python311-relocatable

Paquet d'installation silencieuse pour tis-wapt-python311-relocatable

3.11.15-37

Les paquets PREPROD sont des paquets construits via LUTI. Ils restent généralement 5 jours en PREPROD, après quoi un deuxième scan VirusTotal est effectué pour vérifier que le status n'a pas changé.
Si le paquet réussit ce dernier contrôle, il est promu en PROD et publié sur le store.

  • package: tis-wapt-python311-relocatable
  • version: 3.11.15-37
  • maintainer: sfonteneau
  • locale: all
  • target_os: windows
  • architecture: x86
  • signature_date:
  • size: 10.57 Mo

package           : tis-wapt-python311-relocatable
version           : 3.11.15-37
architecture      : x86
section           : base
priority          : optional
name              : 
categories        : 
maintainer        : sfonteneau
description       : Package for tis-wapt-python311-relocatable
depends           : 
conflicts         : 
maturity          : PREPROD
locale            : all
target_os         : windows
min_wapt_version  : 2.0
sources           : 
installed_size    : 
impacted_process  : 
description_fr    : Paquet pour tis-wapt-python311-relocatable
description_pl    : Pakiet dla tis-wapt-python311-relocatable
description_de    : Paket für tis-wapt-python311-relocatable
description_es    : Paquete para tis-wapt-python311-relocatable
description_pt    : Pacote para tis-wapt-python311-relocatable
description_it    : Pacchetto per tis-wapt-python311-relocatable
description_nl    : Pakket voor tis-wapt-python311-relocatable
description_ru    : Пакет для tis-wapt-python311-relocatable
audit_schedule    : 
editor            : 
keywords          : 
licence           : 
homepage          : 
package_uuid      : 7bb42dec-231d-4762-879b-61bf2de64999
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 
max_os_version    : 
icon_sha256sum    : b55b23fa81945c6cd4c2f4f114188aa9f8f3d0c3cbb9fb353b2803ffbb67b43b
signer            : test
signer_fingerprint: b82fc8ef4a4475c0f69ac168176c2bfc58f572eb716c4eadd65e4785c155dd8e
signature_date    : 2026-06-25T13:52:11.000000
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes
signature         : T8/wqsThopuDwgYpQeADO+rayKsuPSRt5yjAEfnQBL+QjYMW7O4GCWv9h80XzajrUX/CJJ/cm8v4oUjbH7P3jxhlUNauZ7pvn83Ce4zUraZf9sttEoHWsDpivZLkpdx1Zq4BIW2UAPvsTev+GKQ7gAbSIT6wcUe+oK9/6cY1ehlTnDHUOPuLA1UiIrHH1qt+0pUwmTG/jdMhIG2AX2ha8f5HNSIlcSUk0ZHw+Dh3BwA9+4IwHJIFH6/nFLhCIBeWhtO8Dqj9C7owMksnGdiDS0CH4c1nDbABS1zvykbIC2zejJeG7x5nQmfs0IQFWJHbI3l0dHVbH8wPzsqV9hOJeg==

# -*- coding: utf-8 -*-
from setuphelpers import *
from waptutils import default_overwrite
import glob

path_python310_tis = makepath(programfiles32,"python310-tis")

def install():
    copytree2('Python-%s' % control.get_software_version(),path_python310_tis,onreplace=default_overwrite)
    run("%s --version" % makepath(path_python310_tis,'python.exe'))

def uninstall():
    remove_tree(path_python310_tis)

# -*- coding: utf-8 -*-

from setupdevhelpers import *
from waptutils import CustomZipFile
from waptutils import create_recursive_zip

import distro
import platform
import tarfile
import json
import subprocess
import datetime
import sys
sys.path.append('.')
from get_cots import download_cots, get_cots_version, get_cots_filename

python_name_file = str(platform.system().lower() + '_' + platform.machine().lower() + '_' .strip('_'))
download_directory = r'c:\tranquilit'





def update_package():
    if platform.system() =='Linux':
        update_package_linux()
        return
    elif platform.system() =='Windows':
        update_package_windows()
        return
    elif platform.system() == 'Darwin':
        update_package_macos()
    else:
        print('non supported os')
        raise()

def update_package_linux():

    #Download and extract python source
    python_version_from_control = control.version.split('-')[0]

    python_version_from_sbom = get_cots_version('Python')
    if python_version_from_control !=python_version_from_sbom:
        raise Exception('Different version in sbom and in control file, please check')
    python_version = python_version_from_sbom

    unix_python_dir='/opt/wapt'
    print("[UTC %s] start building chroot env" % datetime.datetime.utcnow())
    if type_debian():
        subprocess.run('bash step1_prepare_debian_chroot.sh %s' % unix_python_dir, shell=True, stderr=sys.stdout, stdout=open('/root/compile_python.log','w'), check=True)
    elif type_redhat():
        subprocess.run('bash step1_prepare_redhat_chroot.sh %s' % unix_python_dir, shell=True, stderr=sys.stdout, stdout=open('/root/compile_python.log','w'), check=True)

    print("[UTC %s] start downloading cots" % datetime.datetime.utcnow())
    download_cots(download_directory=r'/root/python_build_chroot/root/')

    print("[UTC %s] start compiling python" % datetime.datetime.utcnow())
    filecopyto('step2_compile_python_in_chroot.sh','/root/python_build_chroot/root/')
    filecopyto('fix_python_ssl_3.5.7_support.patch','/root/python_build_chroot/root/')
    subprocess.run('chroot /root/python_build_chroot /bin/bash /root/step2_compile_python_in_chroot.sh  %s' % unix_python_dir, shell=True, stderr=sys.stdout, stdout=open('/root/compile_python.log','a'), check=True)

    print("[UTC %s] targzipping python distrib" % datetime.datetime.utcnow())
    run('tar -zcf %s/python-%s.tar.gz -C /root/python_build_chroot/%s .' % (basedir, python_name_file, unix_python_dir))

    if params:
        commit_count = params.get("commit_count",0)
    else:
        val = subprocess.check_output('git rev-list --count HEAD', shell=True)
        commit_count = int(val)
    control.version = "%s-%s" % (Version(python_version), commit_count)
    control.save_control_to_wapt()

def print_utc(message):
    print("[UTC %s] %s" % (datetime.datetime.utcnow(), message))

def update_package_windows():

    #Download and extract python source
    python_version_from_control = control.version.split('-')[0]

    python_version_from_sbom = get_cots_version('Python')
    if python_version_from_control !=python_version_from_sbom:
        raise Exception('Different version in sbom and in control file, please check')
    python_version = python_version_from_sbom

    print_utc("start building")

    #remove linux specific files from include dir
    remove_file('*.sh')


    print_utc("start downloading cots")
    download_cots(download_directory=basedir)



    unzip_with_7zip(f'Python-{python_version}.tgz',f'Python-{python_version}-tar')
    unzip_with_7zip(rf'Python-{python_version}-tar\Python-{python_version}.tar','.')

    remove_tree(f'Python-{python_version}-tar')
    remove_file(f'Python-{python_version}.tgz')

    #Download and extract openssl source
    openssl_version =get_cots_version('openssl')
    unzip_with_7zip(rf'openssl-{openssl_version}.tar.gz',rf'openssl-{openssl_version}-tar')
    unzip_with_7zip(rf'openssl-{openssl_version}-tar\openssl-{openssl_version}.tar','.')
    remove_tree(rf'openssl-{openssl_version}-tar')
    remove_file(rf'openssl-{openssl_version}.tar.gz')

    if not isfile(r'C:\Program Files\NASM\nasm.exe'):
        error(r'C:\Program Files\NASM\nasm.exe not found')

    print_utc("running get_external.bat")

    filecopyto('get_externals.bat',rf'Python-{python_version}\PCbuild\get_externals.bat')
    run(rf'Python-{python_version}\PCbuild\get_externals.bat',timeout=5000)

    data_custom = r"""## -*- mode: perl; -*-
## Personal configuration targets

my %targets = (
    "VC-WIN32-rtt" => {
        inherit_from     => [ "VC-WIN32" ],
        cflags           => sub{my $v=pop; $v=~ s/\/MD/\/MT/ig; return $v},
        lflags           => "/nologo /release",
    },
    "VC-WIN64A-rtt" => {
        inherit_from     => [ "VC-WIN64A" ],
        cflags           => sub{my $v=pop; $v=~ s/\/MD/\/MT/ig; return $v},
        lflags           => "/nologo /release",
    },
);"""

    with open(rf'openssl-{openssl_version}\Configurations\60-custom.conf','w') as f:
        f.write(data_custom)

    add_to_system_path(r'C:\Program Files\NASM')



    print_utc("compiling openssl")

    run(rf'cd openssl-{openssl_version} & set path=C:\Program Files\NASM;%path% &"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars32.bat" &"C:\Strawberry\perl\bin\perl.exe" configure VC-WIN32-rtt & nmake',timeout=7200)
    name_openssl_folder = glob.glob(rf'Python-{python_version}\externals\openssl-bin-*')[0].split('\\')[-1]
    shutil.move(rf'Python-{python_version}\externals\{name_openssl_folder}\win32',rf'Python-{python_version}\externals\{name_openssl_folder}\win32old')
    shutil.move(rf'openssl-{openssl_version}',rf'Python-{python_version}\externals\{name_openssl_folder}\win32')
    filecopyto(rf'Python-{python_version}\externals\{name_openssl_folder}\win32old\include\applink.c',rf'Python-{python_version}\externals\{name_openssl_folder}\win32\include\applink.c')

    with open(makepath(f'Python-{python_version}','PCbuild','openssl.props'), 'r') as f:
        data=f.read()
    data = data.replace(r"<_DLLSuffix>-1_1</_DLLSuffix>",r"<_DLLSuffix>-3</_DLLSuffix>")
    with open(makepath(f'Python-{python_version}','PCbuild','openssl.props'), 'w') as f:
        f.write(data)

    #Disable VENV_REDIRECT, only for x86
    for vcxproj in ['venvlauncher.vcxproj','venvwlauncher.vcxproj']:
        with open(makepath(f'Python-{python_version}','PCbuild',vcxproj), 'r') as f:
            data=f.read()
        data = data.replace(r";VENV_REDIRECT;",r";")
        with open(makepath(f'Python-{python_version}','PCbuild',vcxproj), 'w') as f:
            f.write(data)

    print_utc("compiling python")
    run(rf'"C:\Program Files\Git\usr\bin\patch.exe" {basedir}\Python-{python_version}\Modules\_ssl.c < {basedir}\fix_python_ssl_3.5.7_support.patch')
    run(rf'Python-{python_version}\PCbuild\build.bat -p Win32  -t Rebuild',timeout=5000)
    run(rf'"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\msbuild.exe" "%s\Python-{python_version}\Tools\msi\make_zip.proj" /t:Build /p:OutputPath="%s"' % (basedir,basedir))

    print_utc("packaging python")
    name_generate = glob.glob('*.zip')[0]
    os.rename(name_generate,f'Python-%s-x86.zip' % python_name_file)

    remove_tree(f'Python-{python_version}')
    #remove_tree(f'openssl-{openssl_version}')
    remove_file('*.tar.gz')
    remove_file('*.tar.xz')
    remove_file('*.tar.bz2')

    commit_count = params.get("commit_count",0)
    control.version = "%s-%s" % (Version(python_version), commit_count)
    control.save_control_to_wapt()






def update_package_macos():
    unix_python_dir = '/opt/python311'

    #Download and extract python source
    python_version_from_control = control.version.split('-')[0]

    python_version_from_sbom = get_cots_version('Python')
    if python_version_from_control !=python_version_from_sbom:
        raise Exception('Different version in sbom and in control file, please check')
    python_version = python_version_from_sbom


    print("[UTC %s] start downloading cots" % datetime.datetime.utcnow())
    download_cots(download_directory=r'/var/root/')
    if get_host_architecture() in ('arm','arm64'):
        wget('http://srvtemplates.ad.tranquil.it/binary_cache/pkg-config_macos_arm64',target='/usr/local/bin/pkg-config', connect_timeout=60, resume=True, sha256='669b796e5df67f8de12eff2eb354c0d7e188bb2ed3285bc02b3510f21858d647')
    else:
        # should precompile pkg-config for macos intel
        wget('http://srvtemplates.ad.tranquil.it/binary_cache/pkg-config_macos_intel',target='/usr/local/bin/pkg-config', connect_timeout=60, resume=True, sha256='669b796e5df67f8de12eff2eb354c0d7e188bb2ed3285bc02b3510f21858d647')        
    
    print("[UTC %s] start compiling python" % datetime.datetime.utcnow())
    filecopyto('step2_compile_python_macos.sh','/var/root/')
    filecopyto('fix_python_ssl_3.5.7_support.patch','/var/root/')
    filecopyto('gpatch','/var/root/')
    run('chmod 755 /var/root/gpatch')

    subprocess.run('/bin/bash step2_compile_python_macos.sh %s' % unix_python_dir, shell=True, stderr=sys.stdout, stdout=open('/var/root/compile_python.log','a'), check=True)


    # should it be done for *.dylib also?
    # should add more glob.glob for lib version evolution
    for filename in glob.glob(os.path.join('opt','python311','lib') + "/**/*.so",recursive=True):
        cmd = '/usr/bin/install_name_tool -rpath  /opt/python311/lib/ /opt/wapt/lib/  %s' % filename
        print("Updating rpath : %s " % cmd)
        try:
            run(cmd)
        except:
            print('error while changing rpath on %s ' % filename)

    print(subprocess.check_output('/opt/wapt/bin/python3 %s ' % os.path.join(basedir,'fix_dylib_macos.py'),shell=True))


    print("[UTC %s] targzipping python distrib" % datetime.datetime.utcnow())
    run('tar -zcf %s/python-%s.tar.gz -C /opt/python311 .' % (basedir, python_name_file))

    if params:
        commit_count = params.get("commit_count",0)
    else:
        val = subprocess.check_output('git rev-list --count HEAD', shell=True)
        commit_count = int(val)
    control.version = "%s-%s" % (Version(python_version), commit_count)
    control.save_control_to_wapt()



cf3341fcf5e49625fbe83bc93e46bd871e2a80296a7a290732095ab30bec719c : Python-windows_amd64-x86.zip
01ca7fe94636e5a08fcb73849d3b5df25d51e2c82f4dd1a08f01798b25899819 : WAPT/certificate.crt
e6149553bae40dfb1f145bea7b26f15905c5ef3afd89761c6e949443d26ed7ab : WAPT/control
b55b23fa81945c6cd4c2f4f114188aa9f8f3d0c3cbb9fb353b2803ffbb67b43b : WAPT/icon.png
0fd11ebf11860588319c08c1fb69a12cadba748410842d40c95c92fe3589aa27 : WAPT/wapt.psproj
4553c4e5f199da0db4dd2b41fc932b36b1d3e59bcc6bb958b41940f63c3d4627 : fix_dylib_macos.py
1db59e9e807643d738cfaedbbea52a45cfd6545868635a4dbcbba48f06ead003 : fix_python_ssl_3.5.7_support.patch
f8b1554394dcefc950d8fc3411b0da482008abc897f98447464f4042022c18de : get_cots.py
0bdb2913db5957002e7c228e3100978d79716f41ca614ec9d747261faefacce6 : get_externals.bat
bcdb906ce3e6bce6d27598f5011f7a1da2e3d2fc345d9c628acf3a2b96c85abc : luti.json
5e88de91515010a3691ca1916783f1d3cc79cc972c3fa2f7c9ce0cffdb48ceca : python_sbom.cdx.json
25a2c359ad8c41c2a877b9154cdb2cc7f1564b907477eb9ae0dbb295cf159bbc : setup.py
3d568ba9f54ba6713727065c2bc63e4e15cdb5134f0cdda8df93a1139d6405e6 : step1_prepare_debian_chroot.sh
81de376778c27bf89795c9aa6dd51e506f1a75883343b6fa51f4cc58ba2fba26 : step1_prepare_redhat_chroot.sh
fd9715213915a17ba66f601d048c2c364b7c343c701791a625c80e7aee39040c : step2_compile_python_in_chroot.sh
73777a18d68543edaa5518690cf486075d8af6b78c56973bc3b1269b22713a8e : step2_compile_python_macos.sh
271e738376274355c9594ffdc24eb0cb8ec10915eb88bc81e48c370c0333c51b : update_package.py