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: ...@@ -125,13 +125,14 @@ class Installer:
_prefer_final = True _prefer_final = True
_use_dependency_links = True _use_dependency_links = True
_allow_picked_versions = True _allow_picked_versions = True
_always_unzip = False
def __init__(self, def __init__(self,
dest=None, dest=None,
links=(), links=(),
index=None, index=None,
executable=sys.executable, executable=sys.executable,
always_unzip=False, always_unzip=None,
path=None, path=None,
newest=True, newest=True,
versions=None, versions=None,
...@@ -156,7 +157,8 @@ class Installer: ...@@ -156,7 +157,8 @@ class Installer:
self._index_url = index self._index_url = index
self._executable = executable 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 path = (path and path[:] or []) + buildout_and_setuptools_path
if dest is not None and dest not in path: if dest is not None and dest not in path:
path.insert(0, dest) path.insert(0, dest)
...@@ -740,9 +742,15 @@ def allow_picked_versions(setting=None): ...@@ -740,9 +742,15 @@ def allow_picked_versions(setting=None):
Installer._allow_picked_versions = bool(setting) Installer._allow_picked_versions = bool(setting)
return old 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, def install(specs, dest,
links=(), index=None, links=(), index=None,
executable=sys.executable, always_unzip=False, executable=sys.executable, always_unzip=None,
path=None, working_set=None, newest=True, versions=None, path=None, working_set=None, newest=True, versions=None,
use_dependency_links=None, allow_hosts=('*',)): use_dependency_links=None, allow_hosts=('*',)):
installer = Installer(dest, links, index, executable, always_unzip, path, installer = Installer(dest, links, index, executable, always_unzip, path,
......
...@@ -220,6 +220,45 @@ can be useful when debugging. ...@@ -220,6 +220,45 @@ can be useful when debugging.
d demo-0.3-py2.4.egg d demo-0.3-py2.4.egg
d demoneeded-1.1-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) >>> rmdir(dest)
>>> dest = tmpdir('sample-install') >>> dest = tmpdir('sample-install')
>>> ws = zc.buildout.easy_install.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