-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from grubyhs/feature/placzykowski/move-choco-to…
…-seperate-py Feature/placzykowski/move choco to seperate py
- Loading branch information
Showing
8 changed files
with
54 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from utilities import * | ||
# Check if Chocolatey (choco) is installed | ||
def is_choco_installed(): | ||
try: | ||
subprocess.run(["choco", "--version"], | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
check=True) | ||
return True | ||
except subprocess.CalledProcessError: | ||
return False | ||
except FileNotFoundError: | ||
return False | ||
|
||
|
||
# Function to install Chocolatey (choco) | ||
def install_choco(): | ||
try: | ||
subprocess.run(["powershell", "-ExecutionPolicy", "Bypass", "-Command", "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"], check=True) | ||
print("Chocolatey (choco) installed successfully.") | ||
except subprocess.CalledProcessError as e: | ||
print(f"Error installing Chocolatey (choco): {e}") | ||
|
||
# Function to upgrade packages using Chocolatey (choco) | ||
def upgrade_choco_packages(): | ||
try: | ||
subprocess.run(["choco", "upgrade", "all", "-y"], check=True) | ||
print("All Chocolatey packages upgraded successfully.") | ||
except subprocess.CalledProcessError as e: | ||
print(f"Error upgrading Chocolatey packages: {e}") | ||
|
||
def choco_upgrade(): | ||
if not is_choco_installed(): | ||
print("Chocolatey (choco) is not installed. Installing it now...") | ||
install_choco() | ||
if is_choco_installed(): | ||
upgrade_choco_packages() | ||
else: | ||
upgrade_choco_packages() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,5 @@ whichcraft==0.6.1 | |
WMI==1.5.1 | ||
zope.event==5.0 | ||
zope.interface==6.3 | ||
requests | ||
wmi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters