Skip to content

Commit b4f9482

Browse files
Update pipwizard.py
1 parent d9139c7 commit b4f9482

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

pipwizard.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
print('''
1919
█▀▀█ ▀█▀ █▀▀█ █ █ ▀█▀ █▀▀▀█ █▀▀█ █▀▀█ █▀▀▄
2020
█▄▄█ █ █▄▄█ █ █ █ █ ▄▄▄▀▀ █▄▄█ █▄▄▀ █ █
21-
█ ▄█▄ █ █▄▀▄█ ▄█▄ █▄▄▄█ █ █ █ █ █▄▄▀ v1.5.1''')
21+
█ ▄█▄ █ █▄▀▄█ ▄█▄ █▄▄▄█ █ █ █ █ █▄▄▀ v1.5.2''')
2222
print(Fore.YELLOW + " PYTHON PACKAGE MANAGER")
2323
print('''
2424
(1) Install package
@@ -85,27 +85,29 @@
8585
try:
8686
subprocess.check_call(["pip", "uninstall", uninstall_pkg])
8787
print(" " + Fore.BLACK + Back.RED + f" Uninstalled {uninstall_pkg} ")
88-
print()
89-
#input(" Press Enter to exit...")
9088
except subprocess.CalledProcessError:
9189
print(" " + Fore.BLACK + Back.RED + " PACKAGE NOT FOUND ")
9290
#input(" Press Enter to exit...")
9391
#break
9492

9593
elif option == "5":
96-
print()
97-
print(Fore.YELLOW + " NOTE: Input package names in the requirements file." + Style.RESET_ALL)
98-
print(Fore.RED + " Batch uninstalling packages..." + Style.RESET_ALL)
99-
print()
94+
confirm = input(Fore.LIGHTRED_EX + " Do you want to proceed? (Y/N): ")
95+
if confirm == "y".lower():
96+
print()
97+
print(Fore.YELLOW + " NOTE: Input package names in the requirements file." + Style.RESET_ALL)
98+
print(Fore.RED + " Batch uninstalling packages..." + Style.RESET_ALL)
99+
print()
100100

101-
with open("requirements.txt") as f:
102-
reqs = f.read().splitlines()
103-
for pkg in reqs:
104-
try:
105-
subprocess.check_call(["pip", "uninstall", "-y", pkg])
106-
print(" " + Fore.BLACK + Back.RED + f" Uinstalled {pkg} ")
107-
except subprocess.CalledProcessError:
108-
print(" " + Fore.BLACK + Back.RED + " PACKAGE NOT FOUND ")
101+
with open("requirements.txt") as f:
102+
reqs = f.read().splitlines()
103+
for pkg in reqs:
104+
try:
105+
subprocess.check_call(["pip", "uninstall", "-y", pkg])
106+
print(" " + Fore.BLACK + Back.RED + f" Uinstalled {pkg} ")
107+
except subprocess.CalledProcessError:
108+
print(" " + Fore.BLACK + Back.RED + " PACKAGE NOT FOUND ")
109+
else:
110+
print(" " + Fore.BLACK + Back.RED + " UNISTALLATION CANCELLED ")
109111

110112
elif option == "6":
111113
print()
@@ -162,4 +164,4 @@
162164

163165

164166

165-
# Copyright © 2023 Ashfaaq Rifath - PipWizard v1.5.1
167+
# Copyright © 2023 Ashfaaq Rifath - PipWizard v1.5.2

0 commit comments

Comments
 (0)