|
1 #!/usr/bin/env python |
|
2 # Copyright (c) 2002-2005 ActiveState Corp. |
|
3 # Author: Trent Mick (TrentM@ActiveState.com) |
|
4 |
|
5 """Distutils setup script for 'which'.""" |
|
6 |
|
7 import sys |
|
8 import os |
|
9 import shutil |
|
10 from distutils.core import setup |
|
11 |
|
12 |
|
13 #---- support routines |
|
14 |
|
15 def _getVersion(): |
|
16 import which |
|
17 return which.__version__ |
|
18 |
|
19 def _getBinDir(): |
|
20 """Return the current Python's bindir.""" |
|
21 if sys.platform.startswith("win"): |
|
22 bindir = sys.prefix |
|
23 else: |
|
24 bindir = os.path.join(sys.prefix, "bin") |
|
25 return bindir |
|
26 |
|
27 |
|
28 #---- setup mainline |
|
29 |
|
30 if sys.platform == "win32": |
|
31 scripts = [] |
|
32 binFiles = ["which.exe", "which.py"] |
|
33 else: |
|
34 #XXX Disable installing which as a script on non-Windows platforms. |
|
35 # It can get in the way of the system which. |
|
36 # |
|
37 #if os.path.exists("which"): |
|
38 # os.remove("which") |
|
39 #shutil.copy2("which.py", "which") |
|
40 #scripts = ["which"] |
|
41 binFiles = [] |
|
42 scripts = [] |
|
43 |
|
44 setup(name="which", |
|
45 version=_getVersion(), |
|
46 description="a portable GNU which replacement", |
|
47 author="Trent Mick", |
|
48 author_email="TrentM@ActiveState.com", |
|
49 url="http://trentm.com/projects/which/", |
|
50 license="MIT License", |
|
51 platforms=["Windows", "Linux", "Mac OS X", "Unix"], |
|
52 long_description="""\ |
|
53 This is a GNU which replacement with the following features: |
|
54 - it is portable (Windows, Linux); |
|
55 - it understands PATHEXT on Windows; |
|
56 - it can print <em>all</em> matches on the PATH; |
|
57 - it can note "near misses" on the PATH (e.g. files that match but |
|
58 may not, say, have execute permissions; and |
|
59 - it can be used as a Python module. |
|
60 """, |
|
61 keywords=["which", "find", "path", "where"], |
|
62 |
|
63 py_modules=['which'], |
|
64 scripts=scripts, |
|
65 # Install the Windows script/executable bits as data files with |
|
66 # distutils chosen scripts install dir on Windows, |
|
67 # "<prefix>/Scripts", is just wrong. |
|
68 data_files=[ (_getBinDir(), binFiles) ], |
|
69 ) |
|
70 |