add relative path support to pamac-install

This commit is contained in:
guinux 2013-04-24 18:45:43 +02:00
parent ba85214300
commit 0e8d52c1bb
4 changed files with 24 additions and 10 deletions

View File

@ -1,5 +1,6 @@
./pamac-daemon.py
./pamac-tray.py
./pamac-install.py
./pamac/main.py
./pamac/common.py
./gui/manager.glade

View File

@ -359,8 +359,8 @@ class PamacDBusService(dbus.service.Object):
pkg = self.handle.load_pkg(tarball_path)
if pkg:
self.t.add_pkg(pkg)
except pyalpm.error as e:
self.error += ' --> '+str(e)+'\n'
except pyalpm.error:
self.error += _('{pkgname} is not a valid path or package name').format(pkgname = tarball_path)
finally:
return self.error

View File

@ -4,6 +4,7 @@
from gi.repository import GObject
from sys import argv
import dbus
from os.path import abspath
from pamac import common, transaction, main
# i18n
@ -42,7 +43,9 @@ def get_pkgs(pkgs):
get_error = ''
for pkg in pkgs:
if '.pkg.tar.' in pkg:
transaction.to_load.add(pkg)
full_path = abspath(pkg)
print('path',full_path)
transaction.to_load.add(full_path)
elif pkg in transaction.syncpkgs.keys():
transaction.to_add.add(pkg)
else:
@ -73,6 +76,7 @@ def install(pkgs):
exiting(_error)
else:
main.set_transaction_sum()
if len(main.transaction_sum) != 0:
main.ConfDialog.show_all()
loop.run()
else:
@ -81,6 +85,12 @@ def install(pkgs):
if response:
main.WarningDialog.hide()
exiting('')
else:
main.WarningDialog.format_secondary_text(_('Nothing to do'))
response = main.WarningDialog.run()
if response:
main.WarningDialog.hide()
exiting('')
loop = GObject.MainLoop()

View File

@ -545,6 +545,8 @@ def finalize():
handle_error(str(e))
def check_conflicts():
warning = ''
error = ''
print('checking...')
ManagerWindow.get_root_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending():
@ -552,13 +554,14 @@ def check_conflicts():
to_check = [transaction.syncpkgs[name] for name in transaction.to_add | transaction.to_update]
if transaction.to_load:
for path in transaction.to_load:
try:
pkg = transaction.handle.load_pkg(path)
if pkg:
to_check.append(pkg)
except pyalpm.error:
error += _('{pkgname} is not a valid path or package name').format(pkgname = path)
already_checked = set(pkg.name for pkg in to_check)
depends = [to_check]
warning = ''
error = ''
pkgs = transaction.handle.get_localdb().search('linux3')
installed_linux = []
# get packages to remove