args = [quote(arg) for arg in args]
return os.spawnl(os.P_WAIT, sys.executable, *args) == 0
-DEFAULT_VERSION = "0.6.10"
+DEFAULT_VERSION = "0.6.13"
DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/"
SETUPTOOLS_FAKED_VERSION = "0.6c11"
dst.close()
return os.path.realpath(saveto)
+def _no_sandbox(function):
+ def __no_sandbox(*args, **kw):
+ try:
+ from setuptools.sandbox import DirectorySandbox
+ if not hasattr(DirectorySandbox, '_old'):
+ def violation(*args):
+ pass
+ DirectorySandbox._old = DirectorySandbox._violation
+ DirectorySandbox._violation = violation
+ patched = True
+ else:
+ patched = False
+ except ImportError:
+ patched = False
+
+ try:
+ return function(*args, **kw)
+ finally:
+ if patched:
+ DirectorySandbox._violation = DirectorySandbox._old
+ del DirectorySandbox._old
+
+ return __no_sandbox
def _patch_file(path, content):
"""Will backup the file then patch it"""
f.close()
return True
+_patch_file = _no_sandbox(_patch_file)
def _same_content(path, content):
return open(path).read() == content
-def _no_sandbox(function):
- def __no_sandbox(*args, **kw):
- try:
- from setuptools.sandbox import DirectorySandbox
- def violation(*args):
- pass
- DirectorySandbox._old = DirectorySandbox._violation
- DirectorySandbox._violation = violation
- patched = True
- except ImportError:
- patched = False
-
- try:
- return function(*args, **kw)
- finally:
- if patched:
- DirectorySandbox._violation = DirectorySandbox._old
- del DirectorySandbox._old
-
- return __no_sandbox
-
-@_no_sandbox
def _rename_path(path):
new_name = path + '.OLD.%s' % time.time()
log.warn('Renaming %s into %s', path, new_name)
'Setuptools distribution', element)
return True
+_remove_flat_installation = _no_sandbox(_remove_flat_installation)
def _after_install(dist):
log.warn('After install bootstrap.')
placeholder = dist.get_command_obj('install').install_purelib
_create_fake_setuptools_pkg_info(placeholder)
-@_no_sandbox
def _create_fake_setuptools_pkg_info(placeholder):
if not placeholder or not os.path.exists(placeholder):
log.warn('Could not find the install location')
finally:
f.close()
+_create_fake_setuptools_pkg_info = _no_sandbox(_create_fake_setuptools_pkg_info)
+
def _patch_egg_dir(path):
# let's check if it's already patched
pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')
f.close()
return True
+_patch_egg_dir = _no_sandbox(_patch_egg_dir)
def _before_install():
log.warn('Before install bootstrap.')
if len(args) > index:
top_dir = args[index+1]
return location.startswith(top_dir)
- elif option == '--user' and USER_SITE is not None:
- return location.startswith(USER_SITE)
+ if arg == '--user' and USER_SITE is not None:
+ return location.startswith(USER_SITE)
return True
def _relaunch():
log.warn('Relaunching...')
# we have to relaunch the process
+ # pip marker to avoid a relaunch bug
+ if sys.argv[:3] == ['-c', 'install', '--single-version-externally-managed']:
+ sys.argv[0] = 'setup.py'
args = [sys.executable] + sys.argv
sys.exit(subprocess.call(args))
for t in types.type_map.values():
t._type_affinity
- @profiling.function_call_count(69, {'2.4': 44, '3.0':77, '3.1':77})
+ @profiling.function_call_count(69, {'2.4': 44,
+ '3.0':77, '3.1':77})
def test_insert(self):
t1.insert().compile()
def test_update_whereclause(self):
t1.update().where(t1.c.c2==12).compile()
- @profiling.function_call_count(195, versions={'2.4':118, '3.0':208, '3.1':208})
+ @profiling.function_call_count(195, versions={'2.4':118,
+ '3.0':208, '3.1':208})
def test_select(self):
s = select([t1], t1.c.c2==t2.c.c1)
s.compile()
def test_profile_3_properties(self):
self.test_baseline_3_properties()
- @profiling.function_call_count(13341, {'2.4': 7963, '2.6+cextension':12447})
+ @profiling.function_call_count(13341, {'2.4': 7963,
+ '2.6+cextension':12447,
+ '2.7+cextension':12447})
def test_profile_4_expressions(self):
self.test_baseline_4_expressions()
- @profiling.function_call_count(1311, {'2.4': 904, '2.6+cextension':1226})
+ @profiling.function_call_count(1311, {'2.4': 904,
+ '2.6+cextension':1226,
+ '2.7+cextension':1226,
+ })
def test_profile_5_aggregates(self):
self.test_baseline_5_aggregates()
self.test_baseline_2_insert()
# this number...
- @profiling.function_call_count(6783, {'2.6':7194, '2.6+cextension':7184})
+ @profiling.function_call_count(6783, {'2.6':7194, '2.7':7298,
+ '2.7+cextension':7288,
+ '2.6+cextension':7184})
def test_profile_3_properties(self):
self.test_baseline_3_properties()
# and this number go down slightly when using the C extensions
- @profiling.function_call_count(22510, {'2.6':24055})
+ @profiling.function_call_count(22510, {'2.6':24055, '2.7':24214})
def test_profile_4_expressions(self):
self.test_baseline_4_expressions()
- @profiling.function_call_count(1313, {'2.6+cextension':1236})
+ @profiling.function_call_count(1313, {'2.6+cextension':1236,
+ '2.7+cextension':1207})
def test_profile_5_aggregates(self):
self.test_baseline_5_aggregates()