commit b41e960e1184813a2c08ce21d769582b53937380 Author: Gabriel Gendron Date: Mon Mar 11 10:43:52 2024 +0100 creation depot 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..6f5a27c --- /dev/null +++ b/WAPT/control @@ -0,0 +1,44 @@ +package : comi-audit-freespace-template +version : 1.0-4 +architecture : all +section : base +priority : optional +name : Audit FreeSpace +categories : System and network +maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ +description : Audit FreeSpace +depends : +conflicts : +maturity : PROD +locale : all +target_os : all +min_wapt_version : 2.0 +sources : +installed_size : +impacted_process : +description_fr : +description_pl : +description_de : +description_es : +description_pt : +description_it : +description_nl : +description_ru : +audit_schedule : 24h +editor : +keywords : +licence : +homepage : +package_uuid : 94017ac5-23b8-4507-b73b-a0160c4bc170 +valid_from : +valid_until : +forced_install_on : +changelog : +min_os_version : +max_os_version : +icon_sha256sum : 0c223120ac1a6e4cd0d0abe04cd831c7d4a4c2661947e758c0f703b656933d9a +signer : ggendron_pem +signer_fingerprint: 244cdf15fa2ea3ead58e4abf232fdf9a30a8a28a798677f71d6a3e76e65f9003 +signature_date : 2024-01-31T14:49:22.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 : nTsjYl7qAomJuOMQnYgq74jjtRwbW7kvZ0O1lHWpzz8++/fnvCQuogike/jKeTeUb/vpJM8NWeOgJM9a3XFGRqb1O9JgPlqc6nYXCEv8NS85am3pLdBody0AkzhuZscQL3NRZKVQL/F8M+6i7zEHM+h4ANKlw1vvZ1JXDU2LPpBbA4Ca4WqLvpYt9CdoyxQ+s95iIzxDvb8TqlgJkVb1jmlZBy34GLoxW/yezHORCDdNOryApWKwpSun3lAHCuy97qPS4i7+x+3JqfTMoqLK9h/4DtH4I5GhY1hZSBmx06rSVgfWqUx8AL+dHDd+eYIfaGOwv5B7sY1IV3hYVMqpkA== \ No newline at end of file diff --git a/WAPT/icon.png b/WAPT/icon.png new file mode 100644 index 0000000..b834393 Binary files /dev/null and b/WAPT/icon.png differ diff --git a/WAPT/manifest.sha256 b/WAPT/manifest.sha256 new file mode 100644 index 0000000..4ee59e1 --- /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","6db7ce53ee117173b3a99095819d524f54009a58c6ae0b8885df5eceebe56def"],["WAPT/icon.png","0c223120ac1a6e4cd0d0abe04cd831c7d4a4c2661947e758c0f703b656933d9a"],["WAPT/wapt.psproj","c6246be77fa0d87cb8860fc9de433dfc02b56edaaca368712d5b6267141eeee4"],["luti.json","b87e0aebd9b5bc3c009a98e4416e9bf9e83f1961419027c1cad02b2645f995dd"],["setup.py","aa04e8170a9780d10cbd5009d3367a6c5ca5146a17796d7a10bb22a9bfd42f1e"],["update_package.py","d53fbebc6ddbd12841df51c7805827dba99ac2a8455aec757433e8fd23692553"]] \ No newline at end of file diff --git a/WAPT/signature.sha256 b/WAPT/signature.sha256 new file mode 100644 index 0000000..4150e85 --- /dev/null +++ b/WAPT/signature.sha256 @@ -0,0 +1 @@ +b0WhNtQnQl3tiO3L1SdlPXvCFuyWyYa5Uobv8Tqufj+JbknsluqqQCPGAtP14cPBNS0pGBBdtQKeZkg5jDoi68QbZQU1UmeRqCHy4egYw93zrlT+XeRRrr07G+5Z+IB3pIyrXtCQH6ih2lBTQ+EcsF/lUdeiKmCBZxPXWIUFssbGEntPQNHIUp8qbvW0fazfJN7QmDDw9/i0+FOO9SwKzAZr0Kjy1efWV9QkZtI8+hzjkNRZI0tGqmPMfVcoKHB+1x8yq3De5o8s8TYum2cCSJHfAvIe+S2x0wxBoaC9Ynf/QZpJOwzsoEhjv57QlFRhKz8GTBqtYn3cZuGeRbA8dg== \ 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/luti.json b/luti.json new file mode 100644 index 0000000..1b09c38 --- /dev/null +++ b/luti.json @@ -0,0 +1,28 @@ +{ + "do_update_package": false, + "do_install": true, + "do_remove": true, + "do_session_setup": true, + "do_audit": true, + "do_upgrade": false, + "upgrade_with_custom_operand_version": null, + "build_package": true, + "upload_to_store": true, + "retention_time": 5, + "upload_files_to_virustotal": true, + "virustotal_exclusion_regex": null, + "virustotal_hash_allowlist": [], + "virustotal_bypass_antivirus_list": [], + "wait_update_package_before_generating_vm": false, + "update_package_dependencies": [], + "force_template_update_package": null, + "keywords_checklist": [], + "run_with_psexec": false, + "check_higher_version": true, + "uninstallkey_timeout": 120, + "preinstalled_package_list": [], + "acceptable_audit_output": "-> OK", + "taskid_luti": "8580dedd-e5f9-41fb-8292-e602f26ed912", + "commit": "27c6342382058fb8e65a5e851768fd1d45caa58f", + "folder_in_git_repo": "tis-audit-freespace/all" +} \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..530fe6b --- /dev/null +++ b/setup.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +from setuphelpers import * +from setupdevhelpers import * + +try: + from waptenterprise.waptservice.enterprise import get_active_sessions, start_interactive_process +except: + from waptservice.enterprise import get_active_sessions, start_interactive_process + +free_space_warning = 20 +free_space_error = 5 +send_message_to_user = True + +message_box_title = "Information message about your PC FreeSpace - The IT Support" +message_box_title_fr = "Message d'information à propos de l'espace disque du PC - Le Support Informatique" +boot_limit_message_string = "Free space is required on your computer because there is less than: " +f'{free_space_error}' +"GB, Do you want to run a disk cleanup?" +boot_limit_message_fr_string = "De l’espace libre est requis sur votre ordinateur car il reste moins de : " +f'{free_space_error}' +" Go, Voulez-vous lancer un nettoyage du disque ?" + +def install(): + pass + +def session_setup(): + # Translating message + if get_language() == "fr": + message_box_title = message_box_title_fr + boot_limit_message_string = boot_limit_message_fr_string + + # 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\Freespace 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\Freespace Information", "Last Check", date) + + # Notify the user + if ask_message(message_box_title, boot_limit_message_string, flags=4, raise_error=False,) == 6 : + run_session_cleaner() + print("reboot") + return "ERROR" + + +def audit(): + if get_os_name() == "Windows": + sys_drive = makepath(systemdrive) + else: + sys_drive = makepath("/") + system_free_space = str(round(get_disk_free_space(sys_drive) / 1073741824, 1)) + system_free_space_str = str(system_free_space + "G") + print(system_free_space_str) + if free_space_error > int(float(system_free_space)) : + print('ERROR') + if send_message_to_user: + run_session_setup(control.package) + return 'ERROR' + if free_space_warning > int(float(system_free_space)) : + + return 'WARNING' + WAPT.write_audit_data_if_changed("audit-freespace", sys_drive, system_free_space_str, keep_days=365) + return "OK" + +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 run_session_cleaner(): + for session_id in get_active_sessions(): + start_interactive_process("cleanmgr", session_id=session_id) # , minimize=True diff --git a/update_package.py b/update_package.py new file mode 100644 index 0000000..a85fe1c --- /dev/null +++ b/update_package.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- +from setuphelpers import * +from setupdevhelpers import * +import waptguihelper + +def update_package(): + # Modify the values from setup.py + define_send_message_to_user = ask_message("Allow display Cleanmgr", "Allow display Cleanmgr", flags=4, raise_error=False,) + define_free_space_warning = ask_input("Alert Threshold", "Alert Threshold in Go", "20") + define_free_space_error = ask_input("Error Threshold", "Error Threshold in Go", "5") + + if define_send_message_to_user == 6 : + new_lines = [] + with open("setup.py", "r", encoding="utf8") as f: + for line in f.readlines(): + if line.startswith("send_message_to_user"): + line = 'send_message_to_user = True''\n' + new_lines.append(line) + with open("setup.py", "w", encoding="utf8", newline="\n") as f: + f.writelines(new_lines) + else : + new_lines = [] + with open("setup.py", "r", encoding="utf8") as f: + for line in f.readlines(): + if line.startswith("send_message_to_user"): + line = 'send_message_to_user = False''\n' + new_lines.append(line) + with open("setup.py", "w", encoding="utf8", newline="\n") as f: + f.writelines(new_lines) + new_lines = [] + with open("setup.py", "r", encoding="utf8") as f: + for line in f.readlines(): + if line.startswith("free_space_warning"): + line = 'free_space_warning = '+ f'{define_free_space_warning}''\n' + new_lines.append(line) + with open("setup.py", "w", encoding="utf8", newline="\n") as f: + f.writelines(new_lines) + new_lines = [] + with open("setup.py", "r", encoding="utf8") as f: + for line in f.readlines(): + if line.startswith("free_space_error"): + line = 'free_space_error = '+ f'{define_free_space_error}''\n' + new_lines.append(line) + with open("setup.py", "w", encoding="utf8", newline="\n") as f: + f.writelines(new_lines) + + # Edit Control + ask_control_package(control.package, "-template") + control.save_control_to_wapt() + return ask_control_version(control.get_software_version()) + + + +def ask_control_version(version, inc_build=False): + """Requesting that the user supply package version for the `control.version`. Additionally it will make sure user will be able to upload_package from WAPT Console""" + package_updated = False + + # Changing version of the package + if Version(version, 4) > Version(control.get_software_version(), 4): + print("Software version updated (from: %s to: %s)" % (control.get_software_version(), Version(version))) + package_updated = True + else: + version_plus = ( + ".".join(version.split(".")[: len(version.split(".")) - 1]) + "." + str(int(version.split(".")[len(version.split(".")) - 1]) + 1) + ) + version = ask_dialog(control.package, "Version must be %s minimum to upload from WAPT Console" % version_plus, version_plus) + if not version: + version = control.get_software_version() + if Version(version, 4) > Version(control.get_software_version(), 4): + print("Software version updated (from: %s to: %s)" % (control.get_software_version(), Version(version))) + package_updated = True + + control.set_software_version(version) + if inc_build: + control.inc_build() + control.save_control_to_wapt() + return package_updated + +def ask_dialog(title, text, default="", stay_on_top=False): + """This function opens a dialog box with a action input""" + return waptguihelper.input_dialog(title, text, default, stay_on_top) + +def ask_control_package(control_package=None, conditionnal_package_name=None, remove_base_files=False): + """Requesting that the user provide a package name to be entered into the control.package field, and offering the possibility of removing the base files (icon.png and changelog.txt) for template package usage + + Args: + control_package (str) : prefilled control_package (default: actual control_package) + conditionnal_package_name (str) : only ask when the control.package contains conditionnal_package_name (default: always ask for control_package) + remove_base_files (bool) : removes base files if parameter is True and conditionnal_package_name is provided (default: False) + """ + if conditionnal_package_name is None or conditionnal_package_name in control.package: + control.package = waptguihelper.input_dialog( + control.package, + "You can redefine the package name", + control_package.replace(conditionnal_package_name, "") if conditionnal_package_name is not None else control_package, + ) + control.save_control_to_wapt() +