tis-vscode-python

2021.11.1422169775-7
Python VSCode Extension
9403 downloads
Download
View on luti logo
tis-vscode-python icon

  Description 

  • package : tis-vscode-python
  • version : 2021.11.1422169775-7
  • architecture : all
  • categories : Development
  • maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ
  • description : Python VSCode Extension
  • locale : all
  • target_os :
  • min_wapt_version : 1.7
  • sources : https://marketplace.visualstudio.com/items/ms-python.python
  • installed_size : 76488704
  • impacted_process : Code
  • description_fr :
  • description_pl :
  • description_de :
  • description_es :
  • description_pt :
  • description_it :
  • description_nl :
  • description_ru :
  • editor : Microsoft
  • licence :
  • signature_date : 2021-11-24T15:22:52.361046
  • Depends :

  Setup.py 

# -*- coding: utf-8 -*-
from setuphelpers import *
import json
import platform

# Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
ext_uid_name = 'ms-python-release'
ext_file_name =  '%s.vsix' % ext_uid_name


def install():
    # Initializing variables
    if get_os_name() == 'Windows':
        app_dir = makepath(programfiles, 'Microsoft VS Code')
    elif get_os_name() == 'Linux':
        app_dir = '/usr/share/code/'
    elif get_os_name() == 'Darwin':
        app_dir = '/Applications/Visual Studio Code.app/'
    ext_path = makepath(app_dir, ext_file_name)

    # Copying extension to app_dir
    print("Copying: %s to: %s" % (ext_file_name, app_dir))
    filecopyto(ext_file_name, app_dir)


def uninstall():
    # Initializing variables
    if get_os_name() == 'Windows':
        app_dir = makepath(programfiles, 'Microsoft VS Code')
    elif get_os_name() == 'Linux':
        app_dir = '/usr/share/code/'
    elif get_os_name() == 'Darwin':
        app_dir = '/Applications/Visual Studio Code.app/'
    ext_path = makepath(app_dir, ext_file_name)

    # Removing extension from app_dir
    print("Removing: %s" % ext_path)
    remove_file(ext_path)


def session_setup():
    # Initializing variables
    if get_os_name() == 'Windows':
        app_dir = makepath(programfiles, 'Microsoft VS Code')
    elif get_os_name() == 'Linux':
        app_dir = '/usr/share/code/'
    elif get_os_name() == 'Darwin':
        app_dir = '/Applications/Visual Studio Code.app/'
    ext_path = makepath(app_dir, ext_file_name)

    # Installing extension in user env
    print("Installing %s extension in user env" % ext_file_name)
    try:
        run('code --install-extension "%s"' % ext_path)
    except:
        run_notfatal('code --install-extension %s --force' % ext_uid_name)


def update_package():
    # Declaring local variables
    result = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    app_name = control.name
    git_repo = 'microsoft/vscode-python'
    url_api = 'https://api.github.com/repos/%s/releases/latest' % git_repo

    # Getting latest version from official sources
    print('API used is: %s' % url_api)
    json_load = json.loads(wgets(url_api, proxies=proxies))
    for download in json_load['assets']:
        if download['name'] == ext_file_name:
            url_dl = download['browser_download_url']
            break
    version = json_load['tag_name']
    latest_bin = ext_file_name

    print("Latest %s version is %s" % (app_name, version))
    print("Download url is %s" % url_dl)

    # Downloading latest binaries
    print('Downloading %s' % latest_bin)
    wget(url_dl, latest_bin, proxies=proxies)

    # Changing version of the package
    if Version(version) > control.get_software_version():
        print("Software version updated from: %s to: %s" % (control.get_software_version(), Version(version)))
        result = True
    control.version = '%s-%s' % (Version(version), control.version.split('-', 1)[-1])
    #control.set_software_version(Version(version))
    control.save_control_to_wapt()

    # Validating update-package-sources
    return result




def get_os_name():
    return platform.system()


def get_proxies():
    import platform
    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


										

  Changelog 



Changelog software url : https://marketplace.visualstudio.com/items/ms-python.python/changelog



No changelog.txt.
									
  manifest.sha256