Ethereal-dev: [Ethereal-dev] idl2eth patch

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Frank Singleton <frank.singleton@xxxxxxxxxxxx>
Date: Tue, 04 Sep 2001 11:16:01 -0500
Hi,

Here is a small patch for idl2eth.

- idl2eth should look in $PYTHONPATH/site-packages/
  for installed "ethereal_be.py" and "ethereal_gen.py"

- If that fails, then look in current directory.

This is to prepare for ethereal_*.py to be installed 
in $PYTHONPATH/site-packages during a "make install".


Cheers / Frank.

-- 
EUS/SV/Z Frank Singleton      ASO Americas BSS
Office : +1 972 583 3251      ECN 800 33251  
Mobile : +1 214 228 0874      Amateur Radio: VK3FCS/KM5WS   
Email : frank.singleton@xxxxxxxxxxxx

Hardware: HP Omnibook 4150 running Redhat Linux 7.1 (2.4.3-12 kernel).
--- ./idl2eth	2001/09/04 13:26:07	1.1
+++ ./idl2eth	2001/09/04 16:11:52	1.8
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: idl2eth,v 1.1 2001/09/04 13:26:07 frank Exp $
+#  $Id: idl2eth,v 1.8 2001/09/04 16:11:52 frank Exp $
 #
 #  File : idl2eth          
 #
@@ -40,17 +40,42 @@
 #
 
 
-if [ $# -lt 1 ]
- #  Must at least supply an IDL file
-then
-   echo "Error, no IDL file specified."
-   echo "Usage: idl2eth idl_file_name"
-   exit 1
+#  Must at least supply an IDL file
+
+if [ $# -lt 1 ]; then
+    echo "idl2eth Error: no IDL file specified."
+    echo "Usage: idl2eth idl_file_name"
+    exit 1;
+fi
+
+#
+# Run ethereal backend, looking for ethereal_be.py and ethereal_gen.py
+# in pythons's "site-packages" directory. If cannot find that, then
+# try looking in current directory. If still cannot, then exit with
+# error.
+
+if [ -f $PYTHONPATH/site-packages/ethereal_be.py ] && [ -f $PYTHONPATH/site-packages/ethereal_gen.py ]; then
+    omniidl  -p $PYTHONPATH/site-packages -b ethereal_be $1
+    exit $?
+fi
+
+# Try current directory.
+
+if [ -f ./ethereal_be.py ] && [ -f ./ethereal_gen.py ]; then
+    omniidl  -p ./ -b ethereal_be $1
+    exit $?
 fi
 
+# Could not find both ethereal_be.py AND ethereal_gen.py
 
-omniidl  -p ./ -b ethereal_be $1
+echo "idl2eth Error: Could not find both ethereal_be.py AND ethereal_gen.py."
+echo "Please ensure you have the PYTHONPATH variable set, or that ethereal_be.py "
+echo "and ethereal_gen.py exist in the current directory. "
+echo
+echo "On this system, PYTHONPATH is : $PYTHONPATH"
+echo
 
+exit 2