fix miscelleanous bugs

This commit is contained in:
guinux
2013-11-24 17:02:04 +01:00
parent 8aaed3ec9c
commit 5c143a9fb5
4 changed files with 42 additions and 22 deletions

View File

@@ -133,13 +133,17 @@ def info(pkgname):
return []
else:
results_dict = r.json()
result = results_dict['results']
if result:
pkg = AURPkg(result)
return pkg
else:
if results_dict['type'] == 'error':
print('failed to get infos about {} from AUR'.format(pkgname))
return None
else:
result = results_dict['results']
if result:
pkg = AURPkg(result)
return pkg
else:
print('failed to get infos about {} from AUR'.format(pkgname))
return None
def multiinfo(pkgnames):
spec = {'type':'multiinfo', 'arg[]':pkgnames}
@@ -151,14 +155,18 @@ def multiinfo(pkgnames):
return []
else:
results_dict = r.json()
results = results_dict['results']
pkgs = []
if results:
for result in results:
pkgs.append(AURPkg(result))
else:
if results_dict['type'] == 'error':
print('failed to get infos about {} from AUR'.format(pkgnames))
return pkgs
return []
else:
pkgs = []
results = results_dict['results']
if results:
for result in results:
pkgs.append(AURPkg(result))
else:
print('failed to get infos about {} from AUR'.format(pkgnames))
return pkgs
def get_extract_tarball(pkg):
try:

View File

@@ -123,6 +123,8 @@ def write_to_buffer(fd, condition):
#print(line.rstrip('\n'))
progress_buffer.insert_at_cursor(line)
progress_bar.pulse()
while Gtk.events_pending():
Gtk.main_iteration()
return True # FUNDAMENTAL, otherwise the callback isn't recalled
else:
return False # Raised an error: exit
@@ -454,6 +456,9 @@ def check_finished_build(data):
path = data[0]
pkg = data[1]
if build_proc.poll() is None:
progress_bar.pulse()
while Gtk.events_pending():
Gtk.main_iteration()
return True
elif build_proc.poll() == 0:
built = []
@@ -464,7 +469,8 @@ def check_finished_build(data):
for new_pkg in new_pkgs:
for item in os.listdir(path):
if os.path.isfile(os.path.join(path, item)):
if fnmatch.fnmatch(item, '{}-{}-*.pkg.tar.?z'.format(new_pkg.name, new_pkg.version)):
# add a * before pkgver if there an epoch variable
if fnmatch.fnmatch(item, '{}-*{}-*.pkg.tar.?z'.format(new_pkg.name, new_pkg.version)):
built.append(os.path.join(path, item))
break
if built:
@@ -496,6 +502,10 @@ def check_finished_build(data):
response = ErrorDialog.run()
if response:
ErrorDialog.hide()
else:
ProgressCancelButton.set_visible(False)
ProgressCloseButton.set_visible(True)
action_long_handler(_('Build process failed.'))
return False
elif build_proc.poll() == 1:
ProgressCancelButton.set_visible(False)