#!/usr/bin/env python

# Copyright (c) 2002 Trent Mick
# 
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
# 
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

"""Distutils setup script for px (and p4lib.py)."""

import sys
import os
from distutils.core import setup


#---- support routines

def _getVersion():
    import px
    return '.'.join([str(n) for n in px._version_])

def _getBinDir():
    """Return the current Python's bindir."""
    if sys.platform.startswith("win"):
        bindir = sys.prefix
    else:
        bindir = os.path.join(sys.prefix, "bin")
    return bindir


#---- setup mainline

if sys.platform.startswith('win'):
    scripts = []
    binFiles = ["px.exe", "px.py"]
else:
    scripts = ["px"]
    binFiles = []

setup(name="px",
      version=_getVersion(),
      description="Perforce 'p4' wrapper and Python interface",
      author="Trent Mick",
      author_email="TrentM@ActiveState.com",
      url="http://starship.python.net/~tmick/",
      license="MIT License",
      platforms=["Windows", "Linux"],
      long_description="""\
'px' is a wrapper command line app around the Perforce command line
client application 'p4'. It provides a light shim around the full
functionality of 'p4', extending some commands and adding others.

'p4lib.py' is a Python inteface for the Perforce command line client. It
is used by 'px'.
""",
      keywords=["Perforce", "p4"],

      py_modules=['p4lib'],
      scripts=scripts,
      data_files=[ (_getBinDir(), binFiles) ],
     )

