tis-waptpython-black icon

waptpython black

Paquet d’installation silencieuse pour waptpython black

25.1.0-19

  • package: tis-waptpython-black
  • name: waptpython black
  • version: 25.1.0-19
  • categories: Development
  • maintainer: WAPT Team,Tranquil IT,Flavien SCHELFAUT
  • locale: all
  • target_os: all
  • architecture: all
  • signature_date:
  • size: 215.94 Ko
  • installed_size: 25.75 Mo
  • homepage : https://github.com/psf/black

package           : tis-waptpython-black
version           : 25.1.0-19
architecture      : all
section           : base
priority          : optional
name              : waptpython black
categories        : Development
maintainer        : WAPT Team,Tranquil IT,Flavien SCHELFAUT
description       : The uncompromising code formatter.
depends           : 
conflicts         : 
maturity          : PROD
locale            : all
target_os         : all
min_wapt_version  : 2.3
sources           : https://pypi.org/project/black/#files
installed_size    : 25752681
impacted_process  : 
description_fr    : 
description_pl    : 
description_de    : 
description_es    : 
description_pt    : 
description_it    : 
description_nl    : 
description_ru    : 
audit_schedule    : 2h
editor            : 
keywords          : waptpython,python,pip,pypi,package,black,automation,autopep8,formatter,gofmt,pyfmt,rustfmt,yapf
licence           : 
homepage          : https://github.com/psf/black
package_uuid      : cc9dad83-c4f3-48e9-a779-7d6a5277361d
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : https://github.com/psf/black/blob/main/CHANGES.md
min_os_version    : 
max_os_version    : 
icon_sha256sum    : 3307da49dca7842503f3369c908cd625f2b16276a8690e4dd37c08a057580c44
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature_date    : 2025-05-24T11:00:18.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         : wp70x1nGDG8fREw7XOcouLKVpO2ypteT1WB4nrvy2B3fp8T68Z1Djwq7lGe0ShfoIQwB/y90kOZIkEuEaUavhrLTAbLdusYwnRcbLfJwfZLmSUT3/3qm8b2hmFWtv8chKZAy27skKhoezSa/qxNIPorPq4XB67oIOZkrhH0bDG1WOikxtU7nBtFZldmoKqfAWRTbmFAzafQT0fkTX5+zXd7qWQSMBeRBMvBCe675hqx/ouP12RO+fTDuMEGoV4PVAiQxJJgHtCrIpVFdparw2iucYiEcjhxfQUpc6+DG2cF9sw/8U6CP5cTeFIF8GRFpLGPsAdA3iaGyJa7FDqhglQ==

# -*- coding: utf-8 -*-
from setuphelpers import *
from setupdevhelpers import *
import sys
import platform

if sys.platform == "win32":
    waptpython_lib_sp_dir = os.sep.join([sys.executable.rsplit(os.path.sep, 1)[0].replace("\\Scripts", ""), "lib", "site-packages"])
else:
    waptpython_lib_sp_dir = os.sep.join([sys.executable.rsplit(os.path.sep, 1)[0].replace("/bin", "/lib/python%s" % str(Version(platform.python_version(),2))), "site-packages"])

def install():
    bin_name = glob.glob('black*.whl')[0]
    unzip(bin_name, waptpython_lib_sp_dir)

def audit():
    
    black_python_version = makepath(waptpython_lib_sp_dir, '_black_version.py')
    black_lib_folder = makepath(waptpython_lib_sp_dir, 'black')
    
    with open(black_python_version) as f:
        lines = f.readlines()
    
    version = next((line.split('=')[-1].strip(' "\n') for line in lines if 'version =' in line), None)
        
    is_latest_version = Version(version) == Version(control.get_software_version())
    
    if not (isdir(black_lib_folder) and is_latest_version):
        return "ERROR"
    
    return "OK"

def uninstall():
    
    pip_unzip_content = [
        'black', 'blackd', 'blib2to3',
        f'black-{control.get_software_version()}.dist-info',
        '_black_version.py'
    ]
    
    for file in pip_unzip_content:
        path_file = makepath(waptpython_lib_sp_dir, file)
        if isfile(path_file):
            remove_file(path_file)
        elif isdir(path_file):
            remove_tree(path_file)

# -*- coding: utf-8 -*-
from setuphelpers import *
from setupdevhelpers import *


def update_package():
    # Declaring local variables
    package_updated = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    
    name_pypi = "black"
    wanted_file = "py3-none-any.whl"
    
    api_url = f"https://pypi.org/pypi/{name_pypi}/json"

    releases_data = wgets(api_url, proxies=proxies, as_json=True)['releases']

    stable_versions = [
        v for v in releases_data
        if not any(tag in v.lower() for tag in ['dev', 'alpha', 'beta'])
    ]
    
    sorted_versions = sorted(stable_versions, key=lambda p: Version(p), reverse=True)
    
    for v in sorted_versions:
        
        candidates = [
            f for f in releases_data[v]
            if not f['yanked'] and f['url'].endswith(wanted_file)
        ]
        
        if candidates:
            file_info = candidates[0]
            download_url = file_info['url']
            sumsha256 = file_info['digests']['sha256']
            version = v
            break

    whl = download_url.split('/')[-1]
    
    wget(download_url, whl, sha256=sumsha256, proxies=proxies)

    for f in glob.glob('*.whl'):
        if f != whl:
            remove_file(f)

    # Changing version of the package
    if Version(version) > Version(control.get_software_version()):
        print(f"Software version updated (from: {control.get_software_version()} to: {Version(version)})")
        package_updated = True
    else:
        print(f"Software version up-to-date ({Version(version)})")

    control.set_software_version(version)
    control.save_control_to_wapt()

    # Validating update-package-sources
    return package_updated

38d056ab130f7bf7c481c12636a4e9959de36561d3dfcbe54c6e3571bc0c1dc3 : WAPT/certificate.crt
e8640e271b9a3171d2404bc969aa9f531bc101f739b589e238a444a751bb6d86 : WAPT/control
3307da49dca7842503f3369c908cd625f2b16276a8690e4dd37c08a057580c44 : WAPT/icon.png
95e8176dae143ba9097f351d174fdaf0ccd29efb414b362ae3fd72bf0f710717 : black-25.1.0-py3-none-any.whl
064b039b44ec5910ca96ef195a804fdbc4fffef0ba18aec675d02f144518b6da : luti.json
03b10df6d2f17afd570efa3ed3360217024779aa523e17512a16e4c70b6326ea : setup.py
c2d4a29e3eb09b30c91d9e4271ed868c125fe6754fba81b1b458dcbbfc452cb1 : update_package.py