Description: Place omniidl python modules in a private directory
 The omniidl code is not meant as importable code but just to make the
 tool work.  Therefore it should live in /usr/lib/omniidl in Debian.
 This also helps dh_python2 do the right thing.
Forwarded: no
Author: Floris Bruynooghe <flub@devork.be>
Last-Update: 2011-07-21

--- a/mk/beforeauto.mk.in
+++ b/mk/beforeauto.mk.in
@@ -40,8 +40,8 @@
 INSTALLINCDIR 	 := $(DESTDIR)@includedir@
 INSTALLBINDIR 	 := $(DESTDIR)@bindir@
 INSTALLLIBDIR 	 := $(DESTDIR)@libdir@
-INSTALLPYTHONDIR := $(DESTDIR)@pythondir@
-INSTALLPYEXECDIR := $(DESTDIR)@pyexecdir@
+INSTALLPYTHONDIR := $(DESTDIR)/usr/lib/omniidl
+INSTALLPYEXECDIR := $(DESTDIR)/usr/lib/omniidl
 INSTALLIDLDIR    := $(DESTDIR)@datadir@/idl
 
 #############################################################################
--- a/src/tool/omniidl/python/scripts/omniidl.in
+++ b/src/tool/omniidl/python/scripts/omniidl.in
@@ -44,8 +44,8 @@
 pylibdir   = archlibdir = None
 binarchdir = os.path.abspath(os.path.dirname(sys.argv[0]))
 
-# Try a path based on the installation prefix
-sppath = "@prefix@/lib/python" + sys.version[:3] + "/site-packages"
+# Try a path based on the installation prefix, customised for Debian
+sppath = "@prefix@/lib/omniidl"
 
 if os.path.isdir(sppath):
     sys.path.append(sppath)
@@ -93,32 +93,6 @@
         if os.path.isdir(archlibdir):
             sys.path.insert(0, archlibdir)
 
-# Last chance, try a path based on the installation prefixes
-sys.path.append("@prefix@/lib/python" + sys.version[:3] + "/site-packages")
-
-paths = [ "@exec_prefix@/lib/python" + sys.version[:3] + "/site-packages",
-          "@pythondir@",
-          "@pyexecdir@" ]
-
-
-# Implement a string replace function for all Python versions. We
-# can't use the version in idlstring.py, since we're trying to work
-# out the path to find modules including that one.
-
-import string
-try:
-    replace = string.replace
-
-except NameError:
-    def replace(s, old, new):
-        return s.replace(old, new)
-
-
-# Autoconf insists on making our life difficult...
-for path in paths:
-    path = replace(path, "${exec_prefix}", "@exec_prefix@")
-    path = replace(path, "${prefix}", "@prefix@")
-    sys.path.append(path)
 
 try:
     import _omniidl
