python/which/setup.py

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

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

mercurial