Détails du package smp-pyscripter_3.6.0-11_all.wapt
retour Revenir à la liste des packages

smp-pyscripter

ATTENTION CE DÉPÔT n'est plus compatible 1.3 vous devez migrer en 1.5.1.21 !

Fichier control :

package           : smp-pyscripter
version           : 3.6.0-11
architecture      : all
section           : base
priority          : optional
maintainer        : TIS <technique@tranquil-it-systems.fr>
description       : Python development environment
depends           : 
conflicts         : 
maturity          : 
locale            : 
target_os         : windows
min_os_version    : 
max_os_version    : 
min_wapt_version  : 
sources           : 
installed_size    : 
impacted_process  : PyScripter.exe
description_fr    : Environnement de developpement python
description_pl    : 
description_de    : 
description_es    : 
audit_schedule    : 
editor            : 
keywords          : 
licence           : 
homepage          : 
package_uuid      : e4a4e4c6-9966-4114-8ef5-2909714f826b
signer            : wapt.lesfourmisduweb.org
signer_fingerprint: 8da83ebdac1a25e820b186510d049f47407b11835b0664fdc5bacd3595b1671d
signature         : J8Eb27zD3ygl/m6PjWpvBNI8GrKbsyEoQiwxpwzSytOLyhoJcT8Ketng1UMPKpS1v+Q/ljTYjh25N73fMyc7ZuIX2fE6KugXbKUM6/B91qH6S6gtr5F+bv80hZ7zHs9ogcL1EKSiFK6mlEYfP/x+thc2d2gV0rvxnSEu2GOag6hU7we1l2tLFJr+nET0HwbrmDca/GYqg8XlTkrre0AAQTLV6r+Ff1zuZQzgfaCLuQcmC9RKY37u17TpUzkZdGY/vGhJ48m4o2/xc4Yq1217LPzAy/KfR2EJAruEnxZzBGsp45K8YeFDBseGq0v7V93FIBQsNEMiRpqZnT/qHDiR0w==
signature_date    : 20190112-115656
signed_attributes : package,version,architecture,section,priority,maintainer,description,depends,conflicts,maturity,locale,target_os,min_os_version,max_os_version,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,audit_schedule,editor,keywords,licence,homepage,package_uuid,signer,signer_fingerprint,signature_date,signed_attributes






Fichier setup.py :

#!/usr/bin/python
# -*- coding: utf-8 -*-

from setuphelpers import *
import datetime

uninstallkey=[]
listfolder = ['Highlighters','Styles']

optionrunas = inifile_readstring(makepath(install_location('WAPT_is1'),'wapt-get.ini'),'global','pyscripter_runasadmin')
if optionrunas :
    if optionrunas.lower() == 'false' or str(optionrunas) == '0' :
        valuerunas = False
    else:
        valuerunas = True
else:
    valuerunas = True



def install():

    versionpaquet = control['version'].split('-',1)[0]
    install_exe_if_needed('PyScripter-%s-x86-Setup.exe' % versionpaquet,'/VERYSILENT',key='PyScripter_is1',min_version=versionpaquet,killbefore=['PyScripter'])
    for folder in listfolder:
        if isdir(makepath(install_location('PyScripter_is1'),folder)):
            remove_tree(makepath(install_location('PyScripter_is1'),folder))
        copytree2(makepath(folder),makepath(install_location('PyScripter_is1'),folder))

    for prof in local_users_profiles():
        if not 'ServiceProfiles' in prof:
            if isdir(makepath(prof,'AppData','Roaming')):
                fixconfigpyscripter(makepath(prof,'AppData','Roaming'))

    if valuerunas:
        sendmessage = False
        for profsid in reg_enum_subkeys(reg_openkey_noredir(HKEY_LOCAL_MACHINE,r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList')):
            if not profsid.startswith('S-1-5-21-'):
                continue
            profpath = get_profile_path(profsid)
            if isfile(makepath(profpath,u'NTUSER.DAT')):
                try:
                    ntuserdat_path = makepath(profpath,u'NTUSER.DAT')
                    if is_locked(ntuserdat_path):
                        regkey = profsid
                    else:
                        regkey = u"profilemig_%s" % datetime.datetime.now().strftime('%Y%m%d%H%M%S')
                    try:
                        if regkey != profsid :
                            run([u'reg',u'load',u'HKEY_USERS\\%s'%regkey,ntuserdat_path])

                        with reg_openkey_noredir(HKEY_USERS,makepath(regkey,'Software','Microsoft','Windows NT','CurrentVersion','AppCompatFlags','Layers'),sam=KEY_ALL_ACCESS,create_if_missing=True) as Layers:
                            reg_setvalue(Layers,makepath(install_location('PyScripter_is1'),'PyScripter.exe'),value='RUNASADMIN',type=REG_SZ)
                            print('Configure runasadmin for %s in %s' % (makepath(install_location('PyScripter_is1'),'PyScripter.exe'),ntuserdat_path))
                    finally:
                        if regkey != profsid:
                            run_notfatal([u'reg',u'unload',u'HKEY_USERS\\%s'%regkey])
                except Exception as e:
                    if not 'RUNASADMIN' in registry_readstring(HKEY_LOCAL_MACHINE,r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers',makepath(install_location('PyScripter_is1'),'PyScripter.exe')):
                        if registry_readstring(HKEY_LOCAL_MACHINE,r'SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System','EnableLUA') == 1:
                            if get_language() == 'fr':
                                message = ur"""Pour faciliter le développement de paquet wapt, vous devez cocher la case "Exécuter ce programme en tant qu'administrateur" dans l'onget compatibilité du fichier %s (Paramètres pour tous les utilisateurs)""" % (makepath(install_location('PyScripter_is1'),'PyScripter.exe'))
                            else :
                                message = ur"""To facilitate the development of wapt package, you must check the box "Run this program as administrator" in the file compatibility tab %s (Settings for all users)"""  % (makepath(install_location('PyScripter_is1'),'PyScripter.exe'))
                            if not sendmessage :
                                run('msg *  /time:120 %s' % message)
                                sendmessage = True
                        else:
                            print('The uac seems disabled on the machine')
                    else:
                        print('Pyscripter is already configured to run with administrator privileges for all users')

                    print(u'Unable to process profile %s: %s' % (profpath,repr(e)))
    if not installed_softwares('putty'):
        print('Please Install Putty for use ssh in pyscripter')



def session_setup():
    fixconfigpyscripter(application_data())
    if valuerunas :
        registry_setstring(HKEY_CURRENT_USER,r'Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers',makepath(install_location('PyScripter_is1'),'PyScripter.exe'),'RUNASADMIN')

def fixconfigpyscripter(prof):
    profilpy = makepath(prof,'PyScripter')
    if not isdir(profilpy):
        mkdirs(profilpy)
    for folder in listfolder:
        if not isdir(makepath(profilpy,folder)):
            mkdirs(makepath(profilpy,folder))
        for fs in glob.glob(makepath(install_location('PyScripter_is1'),folder,'*')):
            if not isfile(makepath(profilpy,folder,makepath(folder,fs.rsplit('\\',1)[1]))):
                filecopyto(makepath(fs),makepath(profilpy,folder,fs.rsplit('\\',1)[1]))
    if not isfile(makepath(profilpy,"PyScripter.local.ini")):
        inifile_writestring(makepath(profilpy,"PyScripter.local.ini"),'PythonVersions-x86','InstallPath',install_location('WAPT_is1'))
        inifile_writestring(makepath(profilpy,"PyScripter.local.ini"),r'PythonVersions-x86\Custom Versions','Path0',install_location('WAPT_is1'))
        inifile_writestring(makepath(profilpy,"PyScripter.local.ini"),r'PythonVersions-x86\Custom Versions','Count',"0")
    if not isfile(makepath(profilpy,"PyScripter.ini")):
        inifile_writestring(makepath(profilpy,"PyScripter.ini"),r'Other Settings','Style Name',"Windows10")
        inifile_writestring(makepath(profilpy,"PyScripter.ini"),r'IDE Options','AutoCompleteBrackets',"FALSE")
        inifile_writestring(makepath(profilpy,"PyScripter.ini"),r'IDE Options','NewFileEncoding',"sf_UTF8_NoBOM")
        inifile_writestring(makepath(profilpy,"PyScripter.ini"),r'IDE Options','PythonEngineType',"peRemote")
        inifile_writestring(makepath(profilpy,"PyScripter.ini"),r'IDE Options','SSHCommand',"plink")
        inifile_writestring(makepath(profilpy,"PyScripter.ini"),r'IDE Options','SSHOptions',"-batch -P 22")
        inifile_writestring(makepath(profilpy,"PyScripter.ini"),r'IDE Options','ScpCommand',"pscp")
        inifile_writestring(makepath(profilpy,"PyScripter.ini"),r'IDE Options','ScpOptions',"-batch -P 22")
        inifile_writestring(makepath(profilpy,"PyScripter.ini"),r'IDE Options','SSHDisableVariablesWin',"TRUE")

def update_package():

    import requests,urlparse
    url = requests.head('https://sourceforge.net/projects/pyscripter/files/latest/download?source=files',proxies={}).headers['Location']
    dstexe = requests.head(url,proxies={}).headers['Location'].replace('.zip','-Setup.exe').replace('-x64','-x86')
    dstzip = requests.head(url,proxies={}).headers['Location']
    filenamezip = urlparse.unquote(dstzip.rsplit('/',1)[1])
    filename = urlparse.unquote(dstexe.rsplit('/',1)[1])
    vers = filename.split('-')[1].replace('v','')
    print ("Latest Version : " + vers)

    wget(dstzip,filenamezip)
    unzip(filenamezip)
    remove_file(filenamezip)
    folderzip = filenamezip.rsplit('.',1)[0]
    for folder in listfolder:
        if isdir(folder):
            remove_tree(folder)
        copytree2(makepath(folderzip,'PyScripter',folder),folder)
    remove_tree(folderzip)

    exes = glob.glob('*.exe')
    for fn in exes:
        if fn != filename:
            remove_file(fn)

    if not isfile(filename):
        print('Downloading %s from %s'%(filename,dstexe))
        wget(dstexe,filename)
    else:
        print('Already up to date, skipped')

    os.chdir(os.path.dirname(__file__))

    from waptpackage import PackageEntry
    pe = PackageEntry()
    pe.load_control_from_wapt(os.getcwd())

    pe.version = vers + '-0'
    pe.save_control_to_wapt(os.getcwd())

def is_locked(filename):
    """Check if a file is locked"""
    if isfile(filename):
        try:
            open(filename,'r')
            return False
        except IOError as e:
            if e.errno == 13:
                return True
            raise
    else:
        return False

if __name__ == '__main__':
    update_package()