Skip to content

Commit

Permalink
Merge pull request #710 from Ana06/python
Browse files Browse the repository at this point in the history
Add python3.vm
  • Loading branch information
Ana06 authored Oct 20, 2023
2 parents 5c17f0d + 93e9d16 commit 44f157c
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>didier-stevens-suite.vm</id>
<version>0.0.0.20230928</version>
<version>0.0.0.20231019</version>
<authors>Didier Stevens</authors>
<description>Tools colection by Didier Stevens</description>
<description>Tools collection by Didier Stevens</description>
<dependencies>
<dependency id="common.vm" />
<dependency id="python3" version="[3.10.0, 3.11.0)" />
<dependency id="python3.vm" />
</dependencies>
</metadata>
</package>
6 changes: 3 additions & 3 deletions packages/libraries.python3.vm/libraries.python3.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>libraries.python3.vm</id>
<version>0.0.0.20230927</version>
<description>Metapackage to install common Python 3.9 libraries</description>
<version>0.0.0.20231019</version>
<description>Metapackage to install common Python libraries</description>
<authors>Several, check in pypi.org for every of the libraries</authors>
<dependencies>
<dependency id="common.vm" />
<dependency id="vcbuildtools.vm" />
<dependency id="python3" version="[3.10.0, 3.11.0)" />
<dependency id="python3.vm" />
</dependencies>
</metadata>
</package>
6 changes: 3 additions & 3 deletions packages/libraries.python3.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ try {
$modules = $modulesXml.modules.module
foreach ($module in $modules) {
Write-Host "[+] Attempting to install Python3 module: $($module.name)"
$intallValue = $module.name
$installValue = $module.name
if ($module.url) {
$intallValue = $module.url
$installValue = $module.url
}

Invoke-Expression "py -3.10 -m pip install $intallValue 2>&1 >> $outputFile"
Invoke-Expression "py -3.10 -m pip install $installValue 2>&1 >> $outputFile"

if ($LastExitCode -eq 0) {
Write-Host "`t[+] Installed Python 3.10 module: $($module.name)" -ForegroundColor Green
Expand Down
13 changes: 13 additions & 0 deletions packages/python3.vm/python3.vm.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>python3.vm</id>
<version>0.0.0.20231019</version>
<description>Metapackage for Python 3 to ensure all packages use the same Python version.</description>
<authors>Mandiant</authors>
<dependencies>
<dependency id="common.vm" />
<dependency id="python3" version="[3.10.0, 3.11.0)" />
</dependencies>
</metadata>
</package>
11 changes: 11 additions & 0 deletions packages/python3.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$ErrorActionPreference = 'Stop'
Import-Module vm.common -Force -DisableNameChecking

try {
# Re-add shim path to the top of the path to ensure it is found before Python libraries
$shimPath = Join-Path $Env:ChocolateyInstall "bin" -Resolve
[Environment]::SetEnvironmentVariable("Path", "$shimPath;$Env:Path", "Machine")
} catch {
VM-Write-Log-Exception $_
}

1 change: 1 addition & 0 deletions scripts/test/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ class UsesInvalidCategory(Lint):
"notepadplusplus.vm",
"notepadpp.plugin.",
"npcap.vm",
"python3.vm",
"x64dbgpy.vm",
]

Expand Down
2 changes: 1 addition & 1 deletion scripts/test/test_install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ foreach ($package in $packages) {
}


$exclude_tests = @("flarevm.installer.vm", "python3.vm", "installer.vm")
$exclude_tests = @("flarevm.installer.vm", "installer.vm")

$failures = New-Object Collections.Generic.List[string]
$failed = 0
Expand Down

0 comments on commit 44f157c

Please sign in to comment.