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-daemon.py
./pamac-tray.py ./pamac-tray.py
./pamac-install.py
./pamac/main.py ./pamac/main.py
./pamac/common.py ./pamac/common.py
./gui/manager.glade ./gui/manager.glade

View File

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

View File

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

View File

@ -545,6 +545,8 @@ def finalize():
handle_error(str(e)) handle_error(str(e))
def check_conflicts(): def check_conflicts():
warning = ''
error = ''
print('checking...') print('checking...')
ManagerWindow.get_root_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) ManagerWindow.get_root_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending(): 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] to_check = [transaction.syncpkgs[name] for name in transaction.to_add | transaction.to_update]
if transaction.to_load: if transaction.to_load:
for path in transaction.to_load: for path in transaction.to_load:
pkg = transaction.handle.load_pkg(path) try:
if pkg: pkg = transaction.handle.load_pkg(path)
to_check.append(pkg) 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) already_checked = set(pkg.name for pkg in to_check)
depends = [to_check] depends = [to_check]
warning = ''
error = ''
pkgs = transaction.handle.get_localdb().search('linux3') pkgs = transaction.handle.get_localdb().search('linux3')
installed_linux = [] installed_linux = []
# get packages to remove # get packages to remove