#!/usr/bin/env /usr/bin/python

###
### Copyright 2002-2003 Ximian, Inc.
###
### This program is free software; you can redistribute it and/or modify
### it under the terms of the GNU General Public License, version 2,
### as published by the Free Software Foundation.
###
### 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.
###

try:
    import sys
    import os

    rum_dir = "/usr/share/rum"
    rum_version = "1.0.0"

    # FIXME: This has a special check to allow us to run rum in-place
    # without having done a "make install".  We might want to take this
    # out at some point.

    if not (os.path.isfile("./rummain.py") \
            or (os.path.isdir(rum_dir) and os.path.isfile(rum_dir + "/rummain.py"))):
        print "ERROR: rum doesn't appear to be installed properly.  Please check your installation."
        sys.exit(1)


    sys.path.append(rum_dir)
    import rummain

    if "--rum-profile" in sys.argv:
        import profile
        sys.stderr.write("*** Profiling Enabled ***\n")
        sys.argv = filter(lambda x:x != "--rum-profile", sys.argv)
        profile.run("rummain.main(rum_version, rum_dir)")
    else:
        rummain.main(rum_version, rum_dir)
except KeyboardInterrupt:
    # Just quietly exit if we got a ^C
    print
    sys.exit(0)
    

