Commit 8066cd28 authored by Jim Fulton's avatar Jim Fulton

Added an api to change the default policy for unzipping zip-safe eggs.

parent 69313b6d
......@@ -125,13 +125,14 @@ class Installer:
_prefer_final = True
_use_dependency_links = True
_allow_picked_versions = True
_always_unzip = False
def __init__(self,
dest=None,
links=(),
index=None,
executable=sys.executable,
always_unzip=False,
always_unzip=None,
path=None,
newest=True,
versions=None,
......@@ -156,7 +157,8 @@ class Installer:
self._index_url = index
self._executable = executable
self._always_unzip = always_unzip
if always_unzip is not None:
self._always_unzip = always_unzip
path = (path and path[:] or []) + buildout_and_setuptools_path
if dest is not None and dest not in path:
path.insert(0, dest)
......@@ -740,9 +742,15 @@ def allow_picked_versions(setting=None):
Installer._allow_picked_versions = bool(setting)
return old
def always_unzip(setting=None):
old = Installer._always_unzip
if setting is not None:
Installer._always_unzip = bool(setting)
return old
def install(specs, dest,
links=(), index=None,
executable=sys.executable, always_unzip=False,
executable=sys.executable, always_unzip=None,
path=None, working_set=None, newest=True, versions=None,
use_dependency_links=None, allow_hosts=('*',)):
installer = Installer(dest, links, index, executable, always_unzip, path,
......
......@@ -220,6 +220,45 @@ can be useful when debugging.
d demo-0.3-py2.4.egg
d demoneeded-1.1-py2.4.egg
>>> rmdir(dest)
>>> dest = tmpdir('sample-install')
>>> ws = zc.buildout.easy_install.install(
... ['demo'], dest, links=[link_server], index=link_server+'index/',
... always_unzip=False)
>>> ls(dest)
- demo-0.3-py2.4.egg
- demoneeded-1.1-py2.4.egg
We can also set a default by calling the always_unzip function:
>>> zc.buildout.easy_install.always_unzip(True)
False
The old default is returned:
>>> rmdir(dest)
>>> dest = tmpdir('sample-install')
>>> ws = zc.buildout.easy_install.install(
... ['demo'], dest, links=[link_server], index=link_server+'index/')
>>> ls(dest)
d demo-0.3-py2.4.egg
d demoneeded-1.1-py2.4.egg
>>> zc.buildout.easy_install.always_unzip(False)
True
>>> rmdir(dest)
>>> dest = tmpdir('sample-install')
>>> ws = zc.buildout.easy_install.install(
... ['demo'], dest, links=[link_server], index=link_server+'index/')
>>> ls(dest)
- demo-0.3-py2.4.egg
- demoneeded-1.1-py2.4.egg
>>> rmdir(dest)
>>> dest = tmpdir('sample-install')
>>> ws = zc.buildout.easy_install.install(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment