#!/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

    ruck_dir = "/usr/share/ruck"
    ruck_version = "0.5.1"

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

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


    sys.path.append(ruck_dir)
    import ruckmain

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


