Lines 17-77
import portage_util
Link Here
|
17 |
import portage_locks |
17 |
import portage_locks |
18 |
import portage_exception |
18 |
import portage_exception |
19 |
|
19 |
|
|
|
20 |
class stdout_spinner: |
21 |
def __init__(self): |
22 |
spinner_msgs = ["Gentoo Rocks ("+os.uname()[0]+")", |
23 |
"Thank you for using Gentoo. :)", |
24 |
"Are you actually trying to read this?", |
25 |
"How many times have you stared at this?", |
26 |
"We are generating the cache right now", |
27 |
"You are paying too much attention.", |
28 |
"A theory is better than its explanation.", |
29 |
"Phasers locked on target, Captain.", |
30 |
"Thrashing is just virtual crashing.", |
31 |
"To be is to program.", |
32 |
"Real Users hate Real Programmers.", |
33 |
"When all else fails, read the instructions.", |
34 |
"Functionality breeds Contempt.", |
35 |
"The future lies ahead.", |
36 |
"3.1415926535897932384626433832795028841971694", |
37 |
"Sometimes insanity is the only alternative.", |
38 |
"Inaccuracy saves a world of explanation.", |
39 |
] |
40 |
|
41 |
self.spinpos = 0 |
42 |
self.spinner = "/-\\|/-\\|/-\\|/-\\|\\-/|\\-/|\\-/|\\-/|" |
43 |
self.update_spinner = self.update_twirl_spinner |
44 |
|
45 |
if "candy" in portage.settings.features: |
46 |
self.spinner = spinner_msgs[int(time.time()*100)%len(spinner_msgs)] |
47 |
self.update_spinner = self.update_scroll_spinner |
48 |
if not sys.stdout.isatty() or ("--nospinner" in sys.argv): |
49 |
self.update_spinner = self.update_basic_spinner |
50 |
|
51 |
def update_basic_spinner(self): |
52 |
self.spinpos = (self.spinpos+1) % 500 |
53 |
if (self.spinpos % 100) == 0: |
54 |
if self.spinpos == 0: |
55 |
sys.stdout.write(". ") |
56 |
else: |
57 |
sys.stdout.write(".") |
58 |
sys.stdout.flush() |
59 |
|
60 |
def update_scroll_spinner(self): |
61 |
if(self.spinpos >= len(self.spinner)): |
62 |
sys.stdout.write(darkgreen(" \b\b\b"+self.spinner[len(self.spinner)-1-(self.spinpos%len(self.spinner))])) |
63 |
else: |
64 |
sys.stdout.write(green("\b "+self.spinner[self.spinpos])) |
65 |
sys.stdout.flush() |
66 |
self.spinpos = (self.spinpos+1) % (2*len(self.spinner)) |
67 |
|
68 |
def update_twirl_spinner(self): |
69 |
self.spinpos = (self.spinpos+1) % len(self.spinner) |
70 |
sys.stdout.write("\b\b "+self.spinner[self.spinpos]) |
71 |
sys.stdout.flush() |
20 |
|
72 |
|
21 |
spinner_msgs = ["Gentoo Rocks ("+os.uname()[0]+")", |
73 |
spinner=stdout_spinner() |
22 |
"Thank you for using Gentoo. :)", |
|
|
23 |
"Are you actually trying to read this?", |
24 |
"How many times have you stared at this?", |
25 |
"We are generating the cache right now", |
26 |
"You are paying too much attention.", |
27 |
"A theory is better than its explanation.", |
28 |
"Phasers locked on target, Captain.", |
29 |
"Thrashing is just virtual crashing.", |
30 |
"To be is to program.", |
31 |
"Real Users hate Real Programmers.", |
32 |
"When all else fails, read the instructions.", |
33 |
"Functionality breeds Contempt.", |
34 |
"The future lies ahead.", |
35 |
"3.1415926535897932384626433832795028841971694", |
36 |
"Sometimes insanity is the only alternative.", |
37 |
"Inaccuracy saves a world of explanation.", |
38 |
] |
39 |
|
40 |
|
41 |
def update_basic_spinner(): |
42 |
global spinner, spinpos |
43 |
spinpos = (spinpos+1) % 500 |
44 |
if (spinpos % 100) == 0: |
45 |
if spinpos == 0: |
46 |
sys.stdout.write(". ") |
47 |
else: |
48 |
sys.stdout.write(".") |
49 |
sys.stdout.flush() |
50 |
|
51 |
def update_scroll_spinner(): |
52 |
global spinner, spinpos |
53 |
if(spinpos >= len(spinner)): |
54 |
sys.stdout.write(darkgreen(" \b\b\b"+spinner[len(spinner)-1-(spinpos%len(spinner))])) |
55 |
else: |
56 |
sys.stdout.write(green("\b "+spinner[spinpos])) |
57 |
sys.stdout.flush() |
58 |
spinpos = (spinpos+1) % (2*len(spinner)) |
59 |
|
60 |
def update_twirl_spinner(): |
61 |
global spinner, spinpos |
62 |
spinpos = (spinpos+1) % len(spinner) |
63 |
sys.stdout.write("\b\b "+spinner[spinpos]) |
64 |
sys.stdout.flush() |
65 |
|
66 |
spinpos = 0 |
67 |
spinner = "/-\\|/-\\|/-\\|/-\\|\\-/|\\-/|\\-/|\\-/|" |
68 |
update_spinner = update_twirl_spinner |
69 |
if "candy" in portage.settings.features: |
70 |
spinner = spinner_msgs[int(time.time()*100)%len(spinner_msgs)] |
71 |
update_spinner = update_scroll_spinner |
72 |
if not sys.stdout.isatty() or ("--nospinner" in sys.argv): |
73 |
update_spinner = update_basic_spinner |
74 |
|
75 |
|
74 |
|
76 |
if (not sys.stdout.isatty()) or (portage.settings["NOCOLOR"] in ["yes","true"]): |
75 |
if (not sys.stdout.isatty()) or (portage.settings["NOCOLOR"] in ["yes","true"]): |
77 |
nocolor() |
76 |
nocolor() |
Lines 713-719
class search:
Link Here
|
713 |
self.searchkey=re.sub("\+\+","\+\+",self.searchkey) |
712 |
self.searchkey=re.sub("\+\+","\+\+",self.searchkey) |
714 |
self.searchre=re.compile(self.searchkey.lower(),re.I) |
713 |
self.searchre=re.compile(self.searchkey.lower(),re.I) |
715 |
for package in portage.portdb.cp_all(): |
714 |
for package in portage.portdb.cp_all(): |
716 |
update_spinner() |
715 |
spinner.update_spinner() |
717 |
|
716 |
|
718 |
if match_category: |
717 |
if match_category: |
719 |
match_string = package[:] |
718 |
match_string = package[:] |
Lines 915-921
class depgraph:
Link Here
|
915 |
#this conditional is needed to prevent infinite recursion on already-processed deps |
914 |
#this conditional is needed to prevent infinite recursion on already-processed deps |
916 |
return 1 |
915 |
return 1 |
917 |
|
916 |
|
918 |
update_spinner() |
917 |
spinner.update_spinner() |
919 |
|
918 |
|
920 |
mytype,myroot,mykey=mybigkey |
919 |
mytype,myroot,mykey=mybigkey |
921 |
# select the correct /var database that we'll be checking against |
920 |
# select the correct /var database that we'll be checking against |