#!/usr/bin/python
import os
import sys
have_local = False
have_remote = False
specified = []
for arg in sys.argv[1:]:
if arg.startswith('-'):
continue
if os.path.exists(arg):
have_local = True
else:
have_remote = True
specified.append(arg)
if have_local and have_remote:
import gtk
d = gtk.MessageDialog(None, type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK,
message_format="Failed to install packages")
secondary = "Mixing package names and files is not supported:"
for name in specified:
secondary += "\n " + name
d.format_secondary_text(secondary)
d.run()
sys.exit(1)
if have_local:
os.execv("/usr/bin/gpk-install-local-file", ["gpk-install-local-file"] + specified)
else:
os.execv("/usr/bin/gpk-install-package-name", ["gpk-install-package-name"] + specified)