From 0e8d52c1bb7beeb3942ff48093da56823415a244 Mon Sep 17 00:00:00 2001 From: guinux Date: Wed, 24 Apr 2013 18:45:43 +0200 Subject: [PATCH] add relative path support to pamac-install --- files_to_translate | 1 + pamac-daemon.py | 4 ++-- pamac-install.py | 16 +++++++++++++--- pamac/main.py | 13 ++++++++----- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/files_to_translate b/files_to_translate index d985b4c..463fb3f 100644 --- a/files_to_translate +++ b/files_to_translate @@ -1,5 +1,6 @@ ./pamac-daemon.py ./pamac-tray.py +./pamac-install.py ./pamac/main.py ./pamac/common.py ./gui/manager.glade diff --git a/pamac-daemon.py b/pamac-daemon.py index 7df44e8..a4ea9fe 100755 --- a/pamac-daemon.py +++ b/pamac-daemon.py @@ -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 diff --git a/pamac-install.py b/pamac-install.py index 64391f0..606a1f7 100755 --- a/pamac-install.py +++ b/pamac-install.py @@ -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,8 +76,15 @@ def install(pkgs): exiting(_error) else: main.set_transaction_sum() - main.ConfDialog.show_all() - loop.run() + if len(main.transaction_sum) != 0: + 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: main.WarningDialog.format_secondary_text(_('Nothing to do')) response = main.WarningDialog.run() diff --git a/pamac/main.py b/pamac/main.py index 64d0645..3b5fb65 100644 --- a/pamac/main.py +++ b/pamac/main.py @@ -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: - pkg = transaction.handle.load_pkg(path) - if pkg: - to_check.append(pkg) + 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