1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
#!@PYTHON@
# -*- python -*-
# Package : omniidl
# omniidl.in Created on: 1999/10/29
# Author : Duncan Grisby (dpg1)
#
# Copyright (C) 1999 AT&T Laboratories Cambridge
#
# This file is part of omniidl.
#
# omniidl is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#
# Description:
#
# IDL compiler command
import sys
if sys.hexversion < 0x10502f0:
sys.stderr.write("\n\n")
sys.stderr.write("omniidl: WARNING!!\n\n")
sys.stderr.write("omniidl: Python version 1.5.2 or later is required.\n")
sys.stderr.write("omniidl: " + sys.executable + " is version " + \
sys.version + "\n")
sys.stderr.write("omniidl: Execution is likely to fail.\n")
sys.stderr.write("\n\n\n")
sys.stderr.flush()
import os, os.path
pylibdir = archlibdir = None
binarchdir = os.path.abspath(os.path.dirname(sys.argv[0]))
# Try a path based on the installation prefix, customised for Debian
sppath = "@prefix@/lib/omniidl"
if os.path.isdir(sppath):
sys.path.append(sppath)
# Paths in a traditional omni tree
if binarchdir != "":
sys.path.insert(0, binarchdir)
bindir, archname = os.path.split(binarchdir)
treedir, bin = os.path.split(bindir)
if bin == "bin":
pylibdir = os.path.join(treedir, "lib", "python")
vpylibdir = pylibdir + sys.version[:3] + "/site-packages"
vpylib64dir = (os.path.join(treedir, "lib64", "python") +
sys.version[:3] + "/site-packages")
archlibdir = os.path.join(treedir, "lib", archname)
if os.path.isdir(pylibdir):
sys.path.insert(0, pylibdir)
if os.path.isdir(vpylib64dir):
sys.path.insert(0, vpylib64dir)
if os.path.isdir(vpylibdir):
sys.path.insert(0, vpylibdir)
if os.path.isdir(archlibdir):
sys.path.insert(0, archlibdir)
elif archname == "bin":
pylibdir = os.path.join(bindir, "lib", "python")
vpylibdir = pylibdir + sys.version[:3] + "/site-packages"
vpylib64dir = (os.path.join(bindir, "lib64", "python") +
sys.version[:3] + "/site-packages")
archlibdir = os.path.join(bindir, "lib")
if os.path.isdir(pylibdir):
sys.path.insert(0, pylibdir)
if os.path.isdir(vpylib64dir):
sys.path.insert(0, vpylib64dir)
if os.path.isdir(vpylibdir):
sys.path.insert(0, vpylibdir)
if os.path.isdir(archlibdir):
sys.path.insert(0, archlibdir)
try:
import _omniidl
except ImportError, msg:
sys.stderr.write("\n\n")
sys.stderr.write("omniidl: ERROR!\n\n")
sys.stderr.write("omniidl: Could not open IDL compiler module " \
"_omniidlmodule.so\n")
sys.stderr.write("omniidl: Please make sure it is in directory ")
sys.stderr.write((archlibdir or binarchdir) + "\n")
sys.stderr.write("omniidl: (or set the PYTHONPATH environment variable)\n")
sys.stderr.write("\n")
sys.stderr.write("omniidl: (The error was '" + str(msg) + "')\n")
sys.stderr.write("\n\n")
sys.stderr.flush()
sys.exit(1)
try:
import omniidl.main
except ImportError, msg:
sys.stderr.write("\n\n")
sys.stderr.write("omniidl: ERROR!\n\n")
sys.stderr.write("omniidl: Could not open Python files for IDL compiler\n")
sys.stderr.write("omniidl: Please put them in directory " + \
(pylibdir or binarchdir) + "\n")
sys.stderr.write("omniidl: (or set the PYTHONPATH environment variable)\n")
sys.stderr.write("\n")
sys.stderr.write("omniidl: (The error was '" + str(msg) + "')\n")
sys.stderr.write("\n\n")
sys.stderr.flush()
sys.exit(1)
omniidl.main.main()
|