Skip to content
This repository has been archived by the owner on Jun 6, 2018. It is now read-only.

Commit

Permalink
Added 1.1.0 contents
Browse files Browse the repository at this point in the history
  • Loading branch information
o355 committed Jul 26, 2017
1 parent 78a7228 commit b4bd925
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 30 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,10 @@ ENV/
# Rope project settings
.ropeproject
.project

# PyCharm stuff
.idea/workspace.xml
.idea/pipupdate.iml
.idea/modules.xml
.idea/vcs.xml
.idea/misc.xml
17 changes: 12 additions & 5 deletions pipinstall.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# PIPupdate-installPIP 1.0.2
# PIPupdate-installPIP 1.1.0
# External asset to PIPupdate.
# (c) 2016 o355 under the GNU GPL 3.0
# (c) 2016-2017 o355 under the GNU GPL 3.0

print("Welcome to PIPupdate-installPIP (1.0.2)!")
print("Welcome to PIPupdate-installPIP (1.1.0)!")
print("Now installing PIP.")
try:
import sys
Expand Down Expand Up @@ -32,8 +32,15 @@
sys.exit()

print("Now downloading the PIP installer...")
with urllib.request.urlopen('https://bootstrap.pypa.io/get-pip.py') as update_response, open('get-pip.py', 'wb') as update_out_file:
shutil.copyfileobj(update_response, update_out_file)
try:
with urllib.request.urlopen('https://bootstrap.pypa.io/get-pip.py') as update_response, open('get-pip.py', 'wb') as update_out_file:
shutil.copyfileobj(update_response, update_out_file)
except:
print("The PIP installer could not be fetched, either due to a urllib failure, or you don't have an internet connection.",
"Please attempt to download the installer from this url: 'https://bootstrap.pypa.io/get-pip.py'.",
"Save the file in the pipupdate directory. When this process is complete, press enter to continue. Otherwise, press",
"Control + C to exit.", sep="\n")
input()

print("Now running the PIP installer...")
print("Please note: get-pip.py is not developed or maintained by myself.")
Expand Down
34 changes: 20 additions & 14 deletions pipupdate-nc.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# PIPupdate 1.0.2-nocolor
# PIPupdate 1.1.0-nocolor
# Specific PIPupdate version to run
# (c) 2016 o355 under the GNU GPL 3.0
# (c) 2016-2017 o355 under the GNU GPL 3.0

print("Welcome to PIPupdate-nocolor (v1.0.2)!")
print("Welcome to PIPupdate-nocolor (v1.1.0)!")
print("Loading...")

updatecountint = 0
Expand All @@ -23,15 +23,18 @@
try:
import pip
except ImportError:
print("Please install PIP to use PIPupdate-nocolor!")
print("You can also use the pipinstall.py script to install PIP.")
sys.exit()

try:
from subprocess import call
except ImportError:
print("Please install subprocess/subprocess call to use PIPupdate-nocolor!")
sys.exit()
print("Shucks. PIP isn't installed. Would you like me to install PIP for you?")
pipinstall = input("Yes or No: ").lower()
if pipinstall == "yes":
print("Alright. Installing PIP now!")
exec(open("pipinstall.py").read())
elif pipinstall == "no":
print("Alright. Not installing PIP, exiting PIPupdate.")
sys.exit()
else:
print("I couldn't understand what you inputted.")
print("I'll assume you didn't want to install PIP, exiting now.")
sys.exit()

for pkgname in pip.get_installed_distributions():
updatenumber = updatenumber + 1
Expand All @@ -42,8 +45,11 @@
print("PIPupdate: Now attempting to update package " + pkgname.project_name + "...")
updatecountint = updatecountint + 1
updatecountstr = str(updatecountint)
call("pip install --upgrade " + pkgname.project_name, shell=True)
print("PIPupdate: Updated package " + pkgname.project_name + ". Progress: " + updatecountstr + "/" + updatenumberstr + " updates")
try:
pip.main(['install', '--upgrade', pkgname.project_name])
print("PIPupdate: Updated package " + pkgname.project_name + ". Progress: " + updatecountstr + "/" + updatenumberstr + " updates")
except:
print("PIPupdate: Failed to update package " + pkgname.project_name + ". Progress: " + updatecountstr + "/" + updatenumberstr + " updates")

print("")
print("PIPupdate is done, updated " + updatecountstr + " packages!")
Expand Down
20 changes: 9 additions & 11 deletions pipupdate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# PIPupdate 1.0.2
# (c) 2016 o355 under the GNU GPL 3.0
# PIPupdate 1.1.0
# (c) 2016-2017 o355 under the GNU GPL 3.0

print("Welcome to PIPupdate (v1.0.2)")
print("Welcome to PIPupdate (v1.1.0)!")
print("Loading...")

updatecountint = 0
Expand Down Expand Up @@ -31,12 +31,7 @@
print("I couldn't understand what you inputted.")
print("I'll assume you didn't want to install PIP, exiting now.")
sys.exit()

try:
from subprocess import call
except ImportError:
print("Please install subprocess/subprocess call to use PIPupdate!")
sys.exit()


try:
from colorama import init, Fore, Style
Expand Down Expand Up @@ -82,8 +77,11 @@
print(Fore.GREEN + Style.BRIGHT + "PIPupdate: Now attempting to update package " + pkgname.project_name + "..." + Style.RESET_ALL)
updatecountint = updatecountint + 1
updatecountstr = str(updatecountint)
call("pip install --upgrade " + pkgname.project_name, shell=True)
print(Fore.GREEN + Style.BRIGHT + "PIPupdate: Updated package " + pkgname.project_name + ". Progress: " + updatecountstr + "/" + updatenumberstr + " updates")
try:
pip.main(['install', '--upgrade', pkgname.project_name])
print(Fore.GREEN + Style.BRIGHT + "PIPupdate: Updated package " + pkgname.project_name + ". Progress: " + updatecountstr + "/" + updatenumberstr + " updates")
except:
print(Fore.RED + Style.BRIGHT + "PIPupdate: Failed to update package" + pkgname.project_name + ". Progress: " + updatecountstr + "/" + updatenumberstr + " updates")

print(Style.RESET_ALL)
print("PIPupdate is done, updated " + updatecountstr + " packages!")
Expand Down

0 comments on commit b4bd925

Please sign in to comment.