michael@0: #!/usr/bin/env python
michael@0: # Copyright (c) 2002-2005 ActiveState Corp.
michael@0: # Author: Trent Mick (TrentM@ActiveState.com)
michael@0:
michael@0: """Distutils setup script for 'which'."""
michael@0:
michael@0: import sys
michael@0: import os
michael@0: import shutil
michael@0: from distutils.core import setup
michael@0:
michael@0:
michael@0: #---- support routines
michael@0:
michael@0: def _getVersion():
michael@0: import which
michael@0: return which.__version__
michael@0:
michael@0: def _getBinDir():
michael@0: """Return the current Python's bindir."""
michael@0: if sys.platform.startswith("win"):
michael@0: bindir = sys.prefix
michael@0: else:
michael@0: bindir = os.path.join(sys.prefix, "bin")
michael@0: return bindir
michael@0:
michael@0:
michael@0: #---- setup mainline
michael@0:
michael@0: if sys.platform == "win32":
michael@0: scripts = []
michael@0: binFiles = ["which.exe", "which.py"]
michael@0: else:
michael@0: #XXX Disable installing which as a script on non-Windows platforms.
michael@0: # It can get in the way of the system which.
michael@0: #
michael@0: #if os.path.exists("which"):
michael@0: # os.remove("which")
michael@0: #shutil.copy2("which.py", "which")
michael@0: #scripts = ["which"]
michael@0: binFiles = []
michael@0: scripts = []
michael@0:
michael@0: setup(name="which",
michael@0: version=_getVersion(),
michael@0: description="a portable GNU which replacement",
michael@0: author="Trent Mick",
michael@0: author_email="TrentM@ActiveState.com",
michael@0: url="http://trentm.com/projects/which/",
michael@0: license="MIT License",
michael@0: platforms=["Windows", "Linux", "Mac OS X", "Unix"],
michael@0: long_description="""\
michael@0: This is a GNU which replacement with the following features:
michael@0: - it is portable (Windows, Linux);
michael@0: - it understands PATHEXT on Windows;
michael@0: - it can print all matches on the PATH;
michael@0: - it can note "near misses" on the PATH (e.g. files that match but
michael@0: may not, say, have execute permissions; and
michael@0: - it can be used as a Python module.
michael@0: """,
michael@0: keywords=["which", "find", "path", "where"],
michael@0:
michael@0: py_modules=['which'],
michael@0: scripts=scripts,
michael@0: # Install the Windows script/executable bits as data files with
michael@0: # distutils chosen scripts install dir on Windows,
michael@0: # "/Scripts", is just wrong.
michael@0: data_files=[ (_getBinDir(), binFiles) ],
michael@0: )
michael@0: