]> git.meshlink.io Git - catta/blobdiff - avahi-utils/avahi-publish-service.in
* Show some messages when pygtk or twisted is missing for the execution of the python...
[catta] / avahi-utils / avahi-publish-service.in
index ee0be765096333c3b4c0ce1d4b5e0aa6a947d0a4..89c1566195dd875bf527fce7c014042039209656 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
@@ -36,7 +42,7 @@ def usage(retval = 0):
 try:
     opts, args = getopt.getopt(sys.argv[1:], "d:H:", ["help", "domain=", "host="])
 except getopt.GetoptError:
-    usage(2)
+    pass
 
 domain = ""
 host = ""
@@ -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]