python/which/setup.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/python/which/setup.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,70 @@
     1.4 +#!/usr/bin/env python
     1.5 +# Copyright (c) 2002-2005 ActiveState Corp.
     1.6 +# Author: Trent Mick (TrentM@ActiveState.com)
     1.7 +
     1.8 +"""Distutils setup script for 'which'."""
     1.9 +
    1.10 +import sys
    1.11 +import os
    1.12 +import shutil
    1.13 +from distutils.core import setup
    1.14 +
    1.15 +
    1.16 +#---- support routines
    1.17 +
    1.18 +def _getVersion():
    1.19 +    import which
    1.20 +    return which.__version__
    1.21 +
    1.22 +def _getBinDir():
    1.23 +    """Return the current Python's bindir."""
    1.24 +    if sys.platform.startswith("win"):
    1.25 +        bindir = sys.prefix
    1.26 +    else:
    1.27 +        bindir = os.path.join(sys.prefix, "bin")
    1.28 +    return bindir
    1.29 +
    1.30 +
    1.31 +#---- setup mainline
    1.32 +
    1.33 +if sys.platform == "win32":
    1.34 +    scripts = []
    1.35 +    binFiles = ["which.exe", "which.py"]
    1.36 +else:
    1.37 +    #XXX Disable installing which as a script on non-Windows platforms.
    1.38 +    #    It can get in the way of the system which.
    1.39 +    #
    1.40 +    #if os.path.exists("which"):
    1.41 +    #    os.remove("which")
    1.42 +    #shutil.copy2("which.py", "which")
    1.43 +    #scripts = ["which"]
    1.44 +    binFiles = []
    1.45 +    scripts = []
    1.46 +
    1.47 +setup(name="which",
    1.48 +      version=_getVersion(),
    1.49 +      description="a portable GNU which replacement",
    1.50 +      author="Trent Mick",
    1.51 +      author_email="TrentM@ActiveState.com",
    1.52 +      url="http://trentm.com/projects/which/",
    1.53 +      license="MIT License",
    1.54 +      platforms=["Windows", "Linux", "Mac OS X", "Unix"],
    1.55 +      long_description="""\
    1.56 +This is a GNU which replacement with the following features:
    1.57 +    - it is portable (Windows, Linux);
    1.58 +    - it understands PATHEXT on Windows;
    1.59 +    - it can print <em>all</em> matches on the PATH;
    1.60 +    - it can note "near misses" on the PATH (e.g. files that match but
    1.61 +      may not, say, have execute permissions; and
    1.62 +    - it can be used as a Python module.
    1.63 +""",
    1.64 +      keywords=["which", "find", "path", "where"],
    1.65 +
    1.66 +      py_modules=['which'],
    1.67 +      scripts=scripts,
    1.68 +      # Install the Windows script/executable bits as data files with
    1.69 +      # distutils chosen scripts install dir on Windows,
    1.70 +      # "<prefix>/Scripts", is just wrong.
    1.71 +      data_files=[ (_getBinDir(), binFiles) ],
    1.72 +     )
    1.73 +

mercurial