commit bf7700fa42af2470bb02ac5af583a9f8c9068a59 Author: Gabriel Gendron Date: Thu Mar 14 11:02:08 2024 +0100 first commit diff --git a/.env b/.env new file mode 100644 index 0000000..7d8f006 --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +VIRTUAL_ENV=C:\Program Files (x86)\wapt\ +PYTHONPATH=C:\Program Files (x86)\wapt\ diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..584d5a5 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,305 @@ +{ + "version": "0.2.4", + "configurations": [ + { + "name": "WAPT: install", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "${config:python.wapt-get}", + "args": [ + "install", + "--no-ide", + "${workspaceFolder}" + ], + "console": "integratedTerminal", + "linux": { + "sudo": true + }, + "osx": { + "sudo": true + }, + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "WAPT: remove", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "${config:python.wapt-get}", + "args": [ + "remove", + "--no-ide", + "${workspaceFolder}" + ], + "console": "integratedTerminal", + "linux": { + "sudo": true + }, + "osx": { + "sudo": true + }, + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "WAPT: uninstall", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "${config:python.wapt-get}", + "args": [ + "uninstall", + "--no-ide", + "${workspaceFolder}" + ], + "console": "integratedTerminal", + "linux": { + "sudo": true + }, + "osx": { + "sudo": true + }, + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "WAPT: session-setup", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "${config:python.wapt-get}", + "args": [ + "session-setup", + "--no-ide", + "${workspaceFolder}" + ], + "console": "integratedTerminal", + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "WAPT: audit", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "${config:python.wapt-get}", + "args": [ + "audit", + "-f", + "--no-ide", + "${workspaceFolder}" + ], + "console": "integratedTerminal", + "linux": { + "sudo": true + }, + "osx": { + "sudo": true + }, + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "WAPT: update-package", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "${config:python.wapt-get}", + "args": [ + "update-package-sources", + "--no-ide", + "${workspaceFolder}" + ], + "console": "integratedTerminal", + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "WAPT: -i build-upload", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "${config:python.wapt-get}", + "args": [ + "-i", + "--use-gui", + "build-upload", + "--no-ide", + "${workspaceFolder}" + ], + "console": "integratedTerminal", + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "WAPT: build-package", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "${config:python.wapt-get}", + "args": [ + "build-package", + "--no-ide", + "${workspaceFolder}" + ], + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "DEV: import setup.py", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_import_setup_template.py", + "console": "integratedTerminal", + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "DEV: import update_package.py", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_import_update_template.py", + "console": "integratedTerminal", + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "DEV: complete-package", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_complete_control.py", + "console": "integratedTerminal", + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "DEV: translate-control", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_translate_control.py", + "console": "integratedTerminal", + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "DEV: unify-control files", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_unify_control.py", + "console": "integratedTerminal", + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "DEV: duplicate-os-package-code", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_duplicate_os_package_code.py", + "console": "integratedTerminal", + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "DEV: duplicate update_package.py", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_duplicate_update_package.py", + "console": "integratedTerminal", + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "DEV: change luti.json", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/change_luti_json.py", + "console": "integratedTerminal", + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "DEV: import .gitignore", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_import_gitignore.py", + "console": "integratedTerminal", + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + }, + { + "name": "DEV: quick testing", + "type": "python", + "request": "launch", + "justMyCode": false, + "program": "C:/Program Files (x86)/wapt/public/persistent/package-tools/package-template/launch_quick_testing.py", + "console": "integratedTerminal", + "python": "${command:python.interpreterPath}", + "pythonArgs": [ + "-I", + "-B" + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..1b136ec --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "python.defaultInterpreterPath": "C:\\Program Files (x86)\\wapt\\waptpython.exe", + "python.pythonPath": "C:\\Program Files (x86)\\wapt\\waptpython.exe", + "python.wapt-get": "C:\\Program Files (x86)\\wapt\\wapt-get.py", + "python.formatting.provider": "black", + "python.formatting.blackArgs": + [ + "--line-length", + "150" + ], + "editor.insertSpaces": true, + "files.eol": "\n" +} \ No newline at end of file diff --git a/WAPT/certificate.crt b/WAPT/certificate.crt new file mode 100644 index 0000000..6fd2b31 --- /dev/null +++ b/WAPT/certificate.crt @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDNzCCAh+gAwIBAgIUSsaILn1scDCUhHvihORUTceVhO8wDQYJKoZIhvcNAQEL +BQAwJDELMAkGA1UEBhMCRlIxFTATBgNVBAMMDGdnZW5kcm9uX3BlbTAeFw0yMzEx +MDgwODM0MjhaFw0zMzExMDUwODM0MjhaMCQxCzAJBgNVBAYTAkZSMRUwEwYDVQQD +DAxnZ2VuZHJvbl9wZW0wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCj +Qt/K76QyhKl8ulRmnrCSRnD3UyHBmgAxSDml14sVxuyjVE+WW3umCqrJ2/QL2Sqy +DbxiBeexaaVSM15pKcsHQSGnCy762IjBhJIc9iW1QxNi1z/BivBVmAZRmM12IsKj +VeVs5oKpHjO5Uw2R+/MKkqg/9rNk3MQNA44YcFIz4RSfU5IElKU3CwzYFPwdRBSv +Sjf+onG4MkbEbL7B0axeMsKYZ2gxyuU9H73eUwWXgs2ICUu0wlyzKil1jJabKlEr +vREIvt+TL1hUFVLzbADgQPmZhCC2aylzdiYlwaKgNUmwEOip3JpZe0ay8XkIhH2O +H0i5RzPHD0FJae1Og9J7AgMBAAGjYTBfMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O +BBYEFIJMVc1b++36XjWfjFhF+5AfxigaMA4GA1UdDwEB/wQEAwIB1jAdBgNVHSUE +FjAUBggrBgEFBQcDAgYIKwYBBQUHAwMwDQYJKoZIhvcNAQELBQADggEBAJkDZMAN +7aI3TPEXKAHWFBI25+CkV1OL+/NIhgdI3JVvu3rQ2iUcFS08+7rMa555OT3YjTFJ +4Cm0onhdXhVS0ENjvlfm2gWoD5t9SP9ZN4t1K19PDY6SCAqV79pYu2KfuHRXhmSZ +2p/tS1i01dkulJ49AKZNSp3BJ3xThL5oJHHOMgF5msRjZHBMRPsz3HgksaKzn3TE +fzyJ2/izHvTzllez7Ns90eVGPKMvZtZDSq+YpAhVSb6Fn46WVS2Z6Ce3GfRUiN6b +RJ4IQ6a+JhTgjJR6XJFQcmfDWFyzHjajd8OhbLuQjTIaiHyYcUNB9oZeyonMZ4ea +5MedsXgtUISHfhs= +-----END CERTIFICATE----- diff --git a/WAPT/control b/WAPT/control new file mode 100644 index 0000000..ceab03c --- /dev/null +++ b/WAPT/control @@ -0,0 +1,44 @@ +package : comi-audit-send-message-update-reboot +version : 0-3 +architecture : all +section : base +priority : optional +name : +categories : +maintainer : ggendron +description : +depends : +conflicts : +maturity : PROD +locale : +target_os : all +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 : f8269313-5d9d-4d68-9f7a-fd539f92e72e +valid_from : +valid_until : +forced_install_on : +changelog : +min_os_version : +max_os_version : +icon_sha256sum : +signer : ggendron_pem +signer_fingerprint: 244cdf15fa2ea3ead58e4abf232fdf9a30a8a28a798677f71d6a3e76e65f9003 +signature_date : 2024-03-14T09:56:36.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 : gvj0i73XJ9LiF8MSuyBPCxtgC1iy3lliYyui59+3blOdeXQiLuXSxUTury4GNeONqCS956papMRhRCJGgEDyi/2zk8voxLU/3vj5yyPkQ5VOrIj61qFKonNJT0COMkzxmgdaIT626ImHQvdXma6qw5/mflRcNJYqx9qYYCYi4ciLNyAsxKE1lVsXQYSvM5K0DBpjSdYTH0JgGIaARR2WdZ9dmFeQk/kRt887Poqy8eMZzMLXljk6rZ8WaCT2smV6qCMe8jfC1Q3XvmhcBDdC0J1bHBmCwmNpm66tdwR1/lQ8h7DOZF0Yx2Nnbry4yHQLMt9a8xFp/WSGISbYF7pmAw== \ No newline at end of file diff --git a/WAPT/manifest.sha256 b/WAPT/manifest.sha256 new file mode 100644 index 0000000..5838f6c --- /dev/null +++ b/WAPT/manifest.sha256 @@ -0,0 +1 @@ +[[".env","720b2be3b2d977425b68892f478262e7d3f764ca56c86e4d6aa2f639ea3dd214"],[".vscode/launch.json","7185f7797616d2fefe06cdb959ccb08bf0f677287a21aacc3111a65d4f072584"],[".vscode/settings.json","c4ef3e7d26642471ae3a2faaa131a40791fda1542ede085de266c5144adb2a3c"],["WAPT/certificate.crt","68194bca04eef7aaf4dc3c3bd12b017a1263bb5fcc034919fc7edda0c62db266"],["WAPT/control","29d635954328742adc215f918bb5a8871c9ed2c3e2e8a53f512dce85e430f8fd"],["WAPT/wapt.psproj","c6246be77fa0d87cb8860fc9de433dfc02b56edaaca368712d5b6267141eeee4"],["setup.py","85cd6a99bfa858f823a12c98dde587f1ac2edb7da00cca49c05f47598ea10cac"]] \ No newline at end of file diff --git a/WAPT/signature.sha256 b/WAPT/signature.sha256 new file mode 100644 index 0000000..3e3e693 --- /dev/null +++ b/WAPT/signature.sha256 @@ -0,0 +1 @@ +e9lCZcmPQcXTxa3ruXd3M7+p2lEaQpEgGBM/SxPqwwJtabyZK10SyJFsS0p9rDQ6G8LcNFEn7obwKP74BtNZlPC2kg2pHxXZz/nuG6P5MYSuOKQc8LhxrbRh4poC9dxReofw6HBKPHoIyYyxZWoqJRgfANtkbDutOqjf9owx2cDhGH2c3MFZwttim0vmftYxAgy6wwOOmKdpMTvo4biRc3bGt/Pnd/B5MENrvvOwscyRB58POz8fOVQxyrOB175OHIp3p3am4pQz6otOJIB6EXFpwy2ujdh8AQtN/kic1wR7i7q/skEU3Yf7e5X17r5e/hU3aLwhTkPnyBH/cCk9mQ== \ No newline at end of file diff --git a/WAPT/wapt.psproj b/WAPT/wapt.psproj new file mode 100644 index 0000000..31fd757 --- /dev/null +++ b/WAPT/wapt.psproj @@ -0,0 +1,235 @@ +[PyScripter] +Version=3.6.4.0 + +[Project] +ClassName=TProjectRootNode +StoreRelativePaths=TRUE +ShowFileExtensions=FALSE + +[Project\ChildNodes\Node0] +ClassName=TProjectFilesNode + +[Project\ChildNodes\Node0\ChildNodes\Node0] +ClassName=TProjectFolderNode +Name=wapt + +[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node0] +ClassName=TProjectFileNode +FileName=C:\Program Files (x86)\wapt\common.py + +[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node1] +ClassName=TProjectFileNode +FileName=C:\Program Files (x86)\wapt\setuphelpers.py + +[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node2] +ClassName=TProjectFileNode +FileName=C:\Program Files (x86)\wapt\setuphelpers_linux.py + +[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node3] +ClassName=TProjectFileNode +FileName=C:\Program Files (x86)\wapt\setuphelpers_macos.py + +[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node4] +ClassName=TProjectFileNode +FileName=C:\Program Files (x86)\wapt\setuphelpers_unix.py + +[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node5] +ClassName=TProjectFileNode +FileName=C:\Program Files (x86)\wapt\setuphelpers_windows.py + +[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node6] +ClassName=TProjectFileNode +FileName=C:\Program Files (x86)\wapt\wapt-get.ini + +[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node7] +ClassName=TProjectFileNode +FileName=C:\Program Files (x86)\wapt\wapt-get.py + +[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node8] +ClassName=TProjectFileNode +FileName=C:\Program Files (x86)\wapt\waptpackage.py + +[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes] +Count=9 + +[Project\ChildNodes\Node0\ChildNodes\Node1] +ClassName=TProjectFileNode +FileName=$[Project-Path]changelog.txt + +[Project\ChildNodes\Node0\ChildNodes\Node2] +ClassName=TProjectFileNode +FileName=$[Project-Path]control + +[Project\ChildNodes\Node0\ChildNodes\Node3] +ClassName=TProjectFileNode +FileName=$[Project-Path]..\setup.py + +[Project\ChildNodes\Node0\ChildNodes] +Count=4 + +[Project\ChildNodes\Node1] +ClassName=TProjectRunConfiguationsNode + +[Project\ChildNodes\Node1\ChildNodes\Node0] +ClassName=TProjectRunConfiguationNode +Name=WAPT: install + +[Project\ChildNodes\Node1\ChildNodes\Node0\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +Description=Launch package installation. +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=install "$[Project-Path].." +WorkingDir=$[Project-Path].. +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node0\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[ActiveScript-Dir] + +[Project\ChildNodes\Node1\ChildNodes\Node1] +ClassName=TProjectRunConfiguationNode +Name=WAPT: remove + +[Project\ChildNodes\Node1\ChildNodes\Node1\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +Description=Launch uninstallation (the uninstallation code found in local wapt database, remember to launch after an installation). +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=remove "$[Project-Path].." +WorkingDir=$[Project-Path].. +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node1\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[ActiveScript-Dir] + +[Project\ChildNodes\Node1\ChildNodes\Node2] +ClassName=TProjectRunConfiguationNode +Name=WAPT: uninstall + +[Project\ChildNodes\Node1\ChildNodes\Node2\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +Description=Launch uninstallation code (for debugging purpose, it only runs the code of uninstall function). +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=uninstall "$[Project-Path].." +WorkingDir=$[Project-Path].. +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node2\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[Project-Path].. + +[Project\ChildNodes\Node1\ChildNodes\Node3] +ClassName=TProjectRunConfiguationNode +Name=WAPT: session-setup + +[Project\ChildNodes\Node1\ChildNodes\Node3\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +Description=Launch session-setup (it runs directly as current user). +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=session-setup "$[Project-Path].." +WorkingDir=$[Project-Path].. +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node3\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[ActiveScript-Dir] + +[Project\ChildNodes\Node1\ChildNodes\Node4] +ClassName=TProjectRunConfiguationNode +Name=WAPT: audit + +[Project\ChildNodes\Node1\ChildNodes\Node4\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +Description=Launch package audit. +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=audit -f "$[Project-Path].." +WorkingDir=$[Project-Path].. +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node4\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[ActiveScript-Dir] + +[Project\ChildNodes\Node1\ChildNodes\Node5] +ClassName=TProjectRunConfiguationNode +Name=WAPT: update-package + +[Project\ChildNodes\Node1\ChildNodes\Node5\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +Description=Launch update_package (it usually serve to update binaries of the package). +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=update-package-sources "$[Project-Path].." +WorkingDir=$[Project-Path].. +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node5\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[ActiveScript-Dir] + +[Project\ChildNodes\Node1\ChildNodes\Node6] +ClassName=TProjectRunConfiguationNode +Name=WAPT: -i build-upload + +[Project\ChildNodes\Node1\ChildNodes\Node6\RunConfig] +ScriptName=C:\Program Files (x86)\wapt\wapt-get.py +Description=Build and upload package to the waptserver. +EngineType=peRemote +ReinitializeBeforeRun=TRUE +Parameters=--use-gui -i build-upload "$[Project-Path].." +WorkingDir=$[Project-Path].. +WriteOutputToFile=FALSE +OutputFileName=$[ActiveScript-NoExt].log +AppendToFile=FALSE + +[Project\ChildNodes\Node1\ChildNodes\Node6\RunConfig\ExternalRun] +Caption=External Run +Description=Run script using an external Python Interpreter +ApplicationName=$[PythonExe-Short] +Parameters=$[ActiveScript-Short] +WorkingDirectory=$[ActiveScript-Dir] + +[Project\ChildNodes\Node1\ChildNodes] +Count=7 + +[Project\ChildNodes] +Count=2 + +[Project\ExtraPythonPath] +Count=0 + diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..3e13184 --- /dev/null +++ b/setup.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +from setuphelpers import * +from setupdevhelpers import * +import psutil +import time +import datetime +import ctypes + +try: + from waptenterprise.waptservice.enterprise import get_active_sessions, start_interactive_process +except: + from waptservice.enterprise import get_active_sessions, start_interactive_process +import win32api +import sys +import platform + +message_box_title = "Information message about your PC uptime - The IT Support" +message_box_string = "The computer need restart for apply update" + +def install(): + pass + +def audit(): + + if reg_key_exists(HKEY_LOCAL_MACHINE,r'SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired'): + print("Une mise à jour necéssite un redémarrage") + run_session_setup(control.package) + return "WARNING" + return "OK" + +def session_setup(): + + # Avoiding user pop-up spamming + # check_timeout = 1800 + # date_format = "%Y-%m-%d %H:%M:%S" # datetime.datetime.strptime(date_pwsh, "%Y/%m/%d %H:%M:%S") + # date = run_powershell('Get-Date -Format "yyyy-MM-dd HH:mm:ss"') # datetime.datetime.now() + # date_reg = registry_readstring(HKEY_CURRENT_USER, r"SOFTWARE\WAPT\Shutdown Information", "Last Check") + # if date_reg != "": + # date_diff = datetime.datetime.strptime(date, date_format) - datetime.datetime.strptime(date_reg, date_format) + # if date_diff.total_seconds() < check_timeout: + # return "Already checked" + # registry_set(HKEY_CURRENT_USER, r"SOFTWARE\WAPT\Shutdown Information", "Last Check", date) + # Send message to connected user + version = installed_softwares("wapt")[0]["version"] + if version > Version("2.5"): + print("Envoi du message 2.5") + ask_message(message_box_title, message_box_string, flags=0, raise_error=False,) + else: + print("Envoi du message pre 2.5") + message_box( + message_box_title, + message_box_string + ) + +def run_session_setup(package_name): + for session_id in get_active_sessions(): + start_interactive_process("wapt-get", "--hide session-setup %s -f" % package_name, session_id=session_id) # , minimize=True + +def message_box(title, text, style=0): + if platform.python_version_tuple()[0] == "3": + import importlib + + importlib.reload(sys) + else: + reload(sys) + sys.setdefaultencoding("utf-8") + + MB_OK = 0 + MB_OKCANCEL = 1 + MB_YESNOCANCEL = 3 + MB_YESNO = 4 + ctypes.windll.user32.MessageBoxW(0, "%s" % text, "%s" % title, style) + return + + +