diff options
author | tarek <none@none> | 2009-09-08 13:12:44 +0200 |
---|---|---|
committer | tarek <none@none> | 2009-09-08 13:12:44 +0200 |
commit | 89e9dfcd6d1d97f8439844a80e66c7c5a9dfaae3 (patch) | |
tree | f7a91a864a41080a94603b33062b8308a1bb60a2 /distribute_setup.py | |
parent | ae8f6226eacfce9c5519f562c750b9db7aa98bdf (diff) | |
download | external_python_setuptools-89e9dfcd6d1d97f8439844a80e66c7c5a9dfaae3.tar.gz external_python_setuptools-89e9dfcd6d1d97f8439844a80e66c7c5a9dfaae3.tar.bz2 external_python_setuptools-89e9dfcd6d1d97f8439844a80e66c7c5a9dfaae3.zip |
easy_install Distribute now calls the setuptools fake machinery fixes #40
--HG--
branch : distribute
extra : rebase_source : abcd8e82c2de583da133b160ba9e31248d5ae264
Diffstat (limited to 'distribute_setup.py')
-rw-r--r-- | distribute_setup.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/distribute_setup.py b/distribute_setup.py index c2ef008f..923a1e98 100644 --- a/distribute_setup.py +++ b/distribute_setup.py @@ -13,6 +13,7 @@ the appropriate options to ``use_setuptools()``. This file can also be run as a script to install or upgrade setuptools. """ +from site import USER_SITE import sys import os import shutil @@ -162,7 +163,7 @@ def _patch_file(path, content): log.warn('Already patched.') return False log.warn('Patching...') - os.rename(path, path +'.OLD.%s' % time.time()) + _rename_path(path) f = open(path, 'w') try: f.write(content) @@ -176,6 +177,14 @@ def _same_content(path, content): def _rename_path(path): new_name = path + '.OLD.%s' % time.time() log.warn('Renaming %s into %s' % (path, new_name)) + try: + from setuptools.sandbox import DirectorySandbox + def _violation(*args): + pass + DirectorySandbox._violation = _violation + except ImportError: + pass + os.rename(path, new_name) return new_name @@ -260,8 +269,9 @@ def before_install(): fake_setuptools() def _under_prefix(location): + if 'install' not in sys.argv: + return True args = sys.argv[sys.argv.index('install')+1:] - for index, arg in enumerate(args): for option in ('--root', '--prefix'): if arg.startswith('%s=' % option): @@ -271,6 +281,8 @@ def _under_prefix(location): if len(args) > index: top_dir = args[index+1] return location.startswith(top_dir) + elif option == '--user': + return location.startswith(USER_SITE) return True def fake_setuptools(): |