Skip to content

Commit

Permalink
Update .py default app execution
Browse files Browse the repository at this point in the history
  • Loading branch information
emtuls committed Aug 26, 2024
1 parent c2e1958 commit 10178fd
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/common.vm/common.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>common.vm</id>
<version>0.0.0.20240821</version>
<version>0.0.0.20240826</version>
<description>Common libraries for VM-packages</description>
<authors>Mandiant</authors>
</metadata>
Expand Down
2 changes: 1 addition & 1 deletion packages/common.vm/tools/vm.common/vm.common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ function VM-Set-Open-With-Association {
# Create the 'command' key and its default value
$commandKey = "${hive}\Software\Classes\${exeName}_auto_file\shell\open\command"
New-Item -Path $commandKey -Force
New-ItemProperty -Path $commandKey -Name '(Default)' -Value "`"$executablePath`" `"%1`""
New-ItemProperty -Path $commandKey -Name '(Default)' -Value "`"$executablePath`" `"%1`" %*"

# Create/update the file extension key
$extKey = "${hive}\Software\Classes\$extension"
Expand Down
6 changes: 3 additions & 3 deletions packages/didier-stevens-beta.vm/didier-stevens-beta.vm.nuspec
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-beta.vm</id>
<version>0.0.0.20240226</version>
<version>0.0.0.20240726</version>
<authors>Didier Stevens</authors>
<description>Beta versions of Didier Stevens's software</description>
<dependencies>
<dependency id="common.vm" version="0.0.0.20231221" />
<dependency id="python3.vm" />
<dependency id="common.vm" version="0.0.0.20240726" />
<dependency id="python3.vm" version="0.0.0.20240726"/>
</dependencies>
</metadata>
</package>
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.20240226</version>
<version>0.0.0.20240726</version>
<authors>Didier Stevens</authors>
<description>Tools collection by Didier Stevens</description>
<dependencies>
<dependency id="common.vm" version="0.0.0.20231221" />
<dependency id="python3.vm" />
<dependency id="common.vm" version="0.0.0.20240726" />
<dependency id="python3.vm" version="0.0.0.20240726"/>
</dependencies>
</metadata>
</package>
4 changes: 2 additions & 2 deletions packages/python3.vm/python3.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>python3.vm</id>
<version>0.0.0.20231019</version>
<version>0.0.0.20240726</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="common.vm" version="0.0.0.20240425" />
<dependency id="python3" version="[3.10.0, 3.11.0)" />
</dependencies>
</metadata>
Expand Down
7 changes: 6 additions & 1 deletion packages/python3.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ $ErrorActionPreference = 'Stop'
Import-Module vm.common -Force -DisableNameChecking

try {
# Remove default python stubs created by Microsoft
Remove-Item $env:USERPROFILE\AppData\Local\Microsoft\WindowsApps\python*.exe

# Set all python files to use correct python3 install
VM-Set-Open-With-Association (Get-Command python).Source ".py"

# 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 $_
}

0 comments on commit 10178fd

Please sign in to comment.