"""
RAVE setup.py install file.

File is meant to be run in the top level package directory
"""
import os
import re
from distutils.core import setup

# In case of AFS--no hard linking!
del os.link

try:
    # Get it from the VERSION file in SVN
    f = open("./VERSION", 'r')
    VERSION = f.readline().strip()
    f.close()
except IOError:
    # Get it from the distribution
    f = open("lib/python/rave/version.py", 'r')
    VERSION = None
    for line in f:
        line = line.strip()
        match = re.match(r'^version\s*=\s*"(.*?)"$', line)
        if match:
            VERSION = match.group(1)
            break
    if VERSION is None:
        raise RuntimeError(
            "Couldn't determine version (possible build error?)")
        

setup( name = "rave",
       version = VERSION,
       description = "Retrospective Analysis and Visualization Engine",
       author = "Phil Groce",
       author_email = "pgroce@cert.org",
       url = "",
       package_dir = { '': 'lib/python' },
       packages = [ "rave",
                    "rave.cache",
                    "rave.cli",
                    "rave.plugins",
                    "rave.util" ],
       scripts = [ 'bin/raved.py',
                   'bin/rave-get.py',
                   'bin/cachefind.py' ]
)
