]> git.meshlink.io Git - catta/blobdiff - avahi-utils/avahi-publish-service.in
* simply compilation a little
[catta] / avahi-utils / avahi-publish-service.in
index ee0be765096333c3b4c0ce1d4b5e0aa6a947d0a4..50b1908c2660f5af9e6d90654323cad6284639c3 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env @PYTHON@
+#!@PYTHON@
 # -*-python-*-
 # $Id$
 
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 # USA.
 
-import avahi, dbus, gobject, sys, getopt
+import sys, getopt
+
+try:
+    import avahi, gobject, dbus
+except ImportError:
+    print "Sorry, to use this tool you need to install Avahi, pygtk and python-dbus."
+    sys.exit(1)
 
 try:
     import dbus.glib
@@ -34,7 +40,7 @@ def usage(retval = 0):
     sys.exit(retval)
 
 try:
-    opts, args = getopt.getopt(sys.argv[1:], "d:H:", ["help", "domain=", "host="])
+    opts, args = getopt.getopt(sys.argv[1:], "hd:H:", ["help", "domain=", "host="])
 except getopt.GetoptError:
     usage(2)
 
@@ -52,8 +58,7 @@ for o, a in opts:
         host = a
 
 if len(args) < 3:
-    sys.stderr.write("Invalid number of arguments\n")
-    sys.exit(1)
+    usage(2)
 
 name = args[0]
 stype = args[1]