Commit 13186e46 authored by Kenneth Reitz's avatar Kenneth Reitz

virtualenv to 1.7

parent aaa3f1ee
...@@ -23,7 +23,7 @@ indent() { ...@@ -23,7 +23,7 @@ indent() {
virtualenv() { virtualenv() {
python - "$@" <<EOF python - "$@" <<EOF
import sys import sys
sys.path.insert(0, "$ROOT_DIR/src/virtualenv-1.6.4") sys.path.insert(0, "$ROOT_DIR/src/virtualenv-1.7")
import virtualenv import virtualenv
virtualenv.main() virtualenv.main()
EOF EOF
......
...@@ -13,11 +13,15 @@ Jannis Leidel ...@@ -13,11 +13,15 @@ Jannis Leidel
Contributors Contributors
------------ ------------
Alex Grönholm
Antonio Cuni Antonio Cuni
Armin Ronacher Armin Ronacher
Chris McDonough
Christian Stefanescu
Christopher Nilsson Christopher Nilsson
Curt Micol Curt Micol
Douglas Creager Douglas Creager
Gunnlaugur Thor Briem
Jeff Hammel Jeff Hammel
Jorge Vargas Jorge Vargas
Josh Bronson Josh Bronson
......
virtualenv
==========
See docs/index.txt for user documentation.
Contributor notes
-----------------
* virtualenv is designed to work on python 2 and 3 with a single code base.
Use Python 3 print-function syntax, and always use sys.exc_info()[1]
inside the `except` block to get at exception objects.
* virtualenv uses git-flow_ to `coordinate development`_.
.. _git-flow: https://github.com/nvie/gitflow
.. _coordinate development: http://nvie.com/posts/a-successful-git-branching-model/
Metadata-Version: 1.0 Metadata-Version: 1.0
Name: virtualenv Name: virtualenv
Version: 1.6.4 Version: 1.7
Summary: Virtual Python Environment builder Summary: Virtual Python Environment builder
Home-page: http://www.virtualenv.org Home-page: http://www.virtualenv.org
Author: Jannis Leidel, Carl Meyer and Brian Rosner Author: Jannis Leidel, Carl Meyer and Brian Rosner
...@@ -22,9 +22,16 @@ Description: ...@@ -22,9 +22,16 @@ Description:
It is licensed under an It is licensed under an
`MIT-style permissive license <https://github.com/pypa/virtualenv/raw/master/LICENSE.txt>`_. `MIT-style permissive license <https://github.com/pypa/virtualenv/raw/master/LICENSE.txt>`_.
You can install it with ``easy_install virtualenv``, or the `latest You can install it with ``pip install virtualenv``, or the `latest
development version <https://github.com/pypa/virtualenv/tarball/develop#egg=virtualenv-dev>`_ development version <https://github.com/pypa/virtualenv/tarball/develop#egg=virtualenv-dev>`_
with ``easy_install virtualenv==dev``. with ``pip install virtualenv==dev``.
You can also use ``easy_install``, or if you have no Python package manager
available at all, you can just grab the single file `virtualenv.py`_ and run
it with ``python virtualenv.py``.
.. _virtualenv.py: https://raw.github.com/pypa/virtualenv/master/virtualenv.py
What It Does What It Does
------------ ------------
...@@ -74,9 +81,65 @@ Description: ...@@ -74,9 +81,65 @@ Description:
You can also set the environment variable VIRTUALENV_USE_DISTRIBUTE. You can also set the environment variable VIRTUALENV_USE_DISTRIBUTE.
A new virtualenv also includes the `pip <http://pypy.python.org/pypi/pip>`_ A new virtualenv also includes the `pip <http://pypy.python.org/pypi/pip>`_
installer, so you can use `ENV/bin/pip`` to install additional packages into installer, so you can use ``ENV/bin/pip`` to install additional packages into
the environment. the environment.
Environment variables and configuration files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virtualenv can not only be configured by passing command line options such as
``--distribute`` but also by two other means:
- Environment variables
Each command line option is automatically used to look for environment
variables with the name format ``VIRTUALENV_<UPPER_NAME>``. That means
the name of the command line options are capitalized and have dashes
(``'-'``) replaced with underscores (``'_'``).
For example, to automatically install Distribute instead of setuptools
you can also set an environment variable::
$ export VIRTUALENV_USE_DISTRIBUTE=true
$ python virtualenv.py ENV
It's the same as passing the option to virtualenv directly::
$ python virtualenv.py --distribute ENV
This also works for appending command line options, like ``--find-links``.
Just leave an empty space between the passsed values, e.g.::
$ export VIRTUALENV_EXTRA_SEARCH_DIR="/path/to/dists /path/to/other/dists"
$ virtualenv ENV
is the same as calling::
$ python virtualenv.py --extra-search-dir=/path/to/dists --extra-search-dir=/path/to/other/dists ENV
- Config files
virtualenv also looks for a standard ini config file. On Unix and Mac OS X
that's ``$HOME/.virtualenv/virtualenv.ini`` and on Windows, it's
``%HOME%\\virtualenv\\virtualenv.ini``.
The names of the settings are derived from the long command line option,
e.g. the option ``--distribute`` would look like this::
[virtualenv]
distribute = true
Appending options like ``--extra-search-dir`` can be written on multiple
lines::
[virtualenv]
extra-search-dir =
/path/to/dists
/path/to/other/dists
Please have a look at the output of ``virtualenv --help`` for a full list
of supported options.
Windows Notes Windows Notes
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
...@@ -167,7 +230,7 @@ Description: ...@@ -167,7 +230,7 @@ Description:
f = open('blog-bootstrap.py', 'w').write(output) f = open('blog-bootstrap.py', 'w').write(output)
Another example is available `here Another example is available `here
<https://svn.openplans.org/svn/fassembler/trunk/fassembler/create-venv-script.py>`_. <https://github.com/socialplanning/fassembler/blob/master/fassembler/create-venv-script.py>`_.
activate script activate script
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
...@@ -184,7 +247,7 @@ Description: ...@@ -184,7 +247,7 @@ Description:
environment in-place.) This is all it does; it's purely a convenience. If environment in-place.) This is all it does; it's purely a convenience. If
you directly run a script or the python interpreter from the virtualenv's you directly run a script or the python interpreter from the virtualenv's
``bin/`` directory (e.g. ``path/to/env/bin/pip`` or ``bin/`` directory (e.g. ``path/to/env/bin/pip`` or
``/path/to/env/bin/python script.py``) there's no need for activation. ``/path/to/env/bin/python script.py``) there's no need for activation.
After activating an environment you can use the function ``deactivate`` to After activating an environment you can use the function ``deactivate`` to
undo the changes to your ``$PATH``. undo the changes to your ``$PATH``.
...@@ -202,15 +265,16 @@ Description: ...@@ -202,15 +265,16 @@ Description:
And use ``deactivate.bat`` to undo the changes. And use ``deactivate.bat`` to undo the changes.
The ``--no-site-packages`` Option The ``--system-site-packages`` Option
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you build with ``virtualenv --system-site-packages ENV``, your virtual
environment will inherit packages from ``/usr/lib/python2.7/site-packages``
(or wherever your global site-packages directory is).
If you build with ``virtualenv --no-site-packages ENV`` it will *not* This can be used if you have control over the global site-packages directory,
inherit any packages from ``/usr/lib/python2.5/site-packages`` (or and you want to depend on the packages there. If you want isolation from the
wherever your global site-packages directory is). This can be used if global system, do not use this flag.
you don't have control over site-packages and don't want to depend on
the packages there, or you just want more isolation from the global
system.
Using Virtualenv without ``bin/python`` Using Virtualenv without ``bin/python``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -231,11 +295,12 @@ Description: ...@@ -231,11 +295,12 @@ Description:
This will change ``sys.path`` and even change ``sys.prefix``, but also allow This will change ``sys.path`` and even change ``sys.prefix``, but also allow
you to use an existing interpreter. Items in your environment will show up you to use an existing interpreter. Items in your environment will show up
first on ``sys.path``, before global items. However, global items will first on ``sys.path``, before global items. However, global items will
always be accessible -- this technique does not support the always be accessible (as if the ``--system-site-packages`` flag had been used
``--no-site-packages`` flag. Also, this cannot undo the activation of other in creating the environment, whether it was or not). Also, this cannot undo
environments, or modules that have been imported. You shouldn't try to, for the activation of other environments, or modules that have been imported.
instance, activate an environment before a web request; you should activate You shouldn't try to, for instance, activate an environment before a web
*one* environment as early as possible, and not do it again in that process. request; you should activate *one* environment as early as possible, and not
do it again in that process.
Making Environments Relocatable Making Environments Relocatable
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -272,8 +337,8 @@ Description: ...@@ -272,8 +337,8 @@ Description:
different (either different versions, or a different filesystem different (either different versions, or a different filesystem
layout). layout).
Currently the ``--no-site-packages`` option will not be honored if you If you use this flag to create an environment, currently, the
use this on an environment. ``--system-site-packages`` option will be implied.
The ``--extra-search-dir`` Option The ``--extra-search-dir`` Option
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -419,10 +484,24 @@ Description: ...@@ -419,10 +484,24 @@ Description:
Changes & News Changes & News
-------------- --------------
Next release (1.7) schedule 1.7 (2011-11-30)
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
* Updated embedded Distribute release to 0.6.24. Thanks Alex Grönholm.
* Made ``--no-site-packages`` behavior the default behavior. The
``--no-site-packages`` flag is still permitted, but displays a warning when
used. Thanks Chris McDonough.
* New flag: ``--system-site-packages``; this flag should be passed to get the
previous default global-site-package-including behavior back.
* Added ability to set command options as environment variables and options
in a ``virtualenv.ini`` file.
* Fixed various encoding related issues with paths. Thanks Gunnlaugur Thor Briem.
Beta release mid-July 2011, final release early August. * Made ``virtualenv.py`` script executable.
1.6.4 (2011-07-21) 1.6.4 (2011-07-21)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
......
#!/usr/bin/env python
"""
Helper script to rebuild virtualenv.py from virtualenv_support
"""
import re
import os
import sys
here = os.path.dirname(__file__)
script = os.path.join(here, '..', 'virtualenv.py')
file_regex = re.compile(
r'##file (.*?)\n([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*convert\("""(.*?)"""\)',
re.S)
file_template = '##file %(filename)s\n%(varname)s = convert("""\n%(data)s""")'
def rebuild():
f = open(script, 'rb')
content = f.read()
f.close()
parts = []
last_pos = 0
match = None
for match in file_regex.finditer(content):
parts.append(content[last_pos:match.start()])
last_pos = match.end()
filename = match.group(1)
varname = match.group(2)
data = match.group(3)
print('Found reference to file %s' % filename)
f = open(os.path.join(here, '..', 'virtualenv_support', filename), 'rb')
c = f.read()
f.close()
new_data = c.encode('zlib').encode('base64')
if new_data == data:
print(' Reference up to date (%s bytes)' % len(c))
parts.append(match.group(0))
continue
print(' Content changed (%s bytes -> %s bytes)' % (
zipped_len(data), len(c)))
new_match = file_template % dict(
filename=filename,
varname=varname,
data=new_data)
parts.append(new_match)
parts.append(content[last_pos:])
new_content = ''.join(parts)
if new_content != content:
sys.stdout.write('Content updated; overwriting... ')
f = open(script, 'wb')
f.write(new_content)
f.close()
print('done.')
else:
print('No changes in content')
if match is None:
print('No variables were matched/found')
def zipped_len(data):
if not data:
return 'no data'
try:
return len(data.decode('base64').decode('zlib'))
except:
return 'unknown'
if __name__ == '__main__':
rebuild()
#!/usr/bin/env python
"""
Refresh any files in ../virtualenv_support/ that come from elsewhere
"""
import os
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
import sys
here = os.path.dirname(__file__)
support_files = os.path.join(here, '..', 'virtualenv_support')
files = [
('http://peak.telecommunity.com/dist/ez_setup.py', 'ez_setup.py'),
('http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg', 'setuptools-0.6c11-py2.6.egg'),
('http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c11-py2.5.egg', 'setuptools-0.6c11-py2.5.egg'),
('http://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c11-py2.4.egg', 'setuptools-0.6c11-py2.4.egg'),
('http://python-distribute.org/distribute_setup.py', 'distribute_setup.py'),
('http://pypi.python.org/packages/source/d/distribute/distribute-0.6.24.tar.gz', 'distribute-0.6.24.tar.gz'),
('http://pypi.python.org/packages/source/p/pip/pip-1.0.2.tar.gz', 'pip-1.0.2.tar.gz'),
]
def main():
for url, filename in files:
sys.stdout.write('fetching %s ... ' % url)
sys.stdout.flush()
f = urlopen(url)
content = f.read()
f.close()
print('done.')
filename = os.path.join(support_files, filename)
if os.path.exists(filename):
f = open(filename, 'rb')
cur_content = f.read()
f.close()
else:
cur_content = ''
if cur_content == content:
print(' %s up-to-date' % filename)
else:
print(' overwriting %s' % filename)
f = open(filename, 'wb')
f.write(content)
f.close()
if __name__ == '__main__':
main()
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/django-compressor.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/django-compressor.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/django-compressor"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/django-compressor"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
/**
* Sphinx stylesheet -- default theme
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
body {
font-family: Arial, sans-serif;
font-size: 100%;
background-color: #111;
color: #555;
margin: 0;
padding: 0;
}
div.documentwrapper {
float: left;
width: 100%;
}
div.bodywrapper {
margin: 0 0 0 230px;
}
hr{
border: 1px solid #B1B4B6;
}
div.document {
background-color: #eee;
}
div.body {
background-color: #ffffff;
color: #3E4349;
padding: 0 30px 30px 30px;
font-size: 0.8em;
}
div.footer {
color: #555;
width: 100%;
padding: 13px 0;
text-align: center;
font-size: 75%;
}
div.footer a {
color: #444;
text-decoration: underline;
}
div.related {
background-color: #6BA81E;
line-height: 32px;
color: #fff;
text-shadow: 0px 1px 0 #444;
font-size: 0.80em;
}
div.related a {
color: #E2F3CC;
}
div.sphinxsidebar {
font-size: 0.75em;
line-height: 1.5em;
}
div.sphinxsidebarwrapper{
padding: 20px 0;
}
div.sphinxsidebar h3,
div.sphinxsidebar h4 {
font-family: Arial, sans-serif;
color: #222;
font-size: 1.2em;
font-weight: normal;
margin: 0;
padding: 5px 10px;
background-color: #ddd;
text-shadow: 1px 1px 0 white
}
div.sphinxsidebar h4{
font-size: 1.1em;
}
div.sphinxsidebar h3 a {
color: #444;
}
div.sphinxsidebar p {
color: #888;
padding: 5px 20px;
}
div.sphinxsidebar p.topless {
}
div.sphinxsidebar ul {
margin: 10px 20px;
padding: 0;
color: #000;
}
div.sphinxsidebar a {
color: #444;
}
div.sphinxsidebar input {
border: 1px solid #ccc;
font-family: sans-serif;
font-size: 1em;
}
div.sphinxsidebar input[type=text]{
margin-left: 20px;
}
/* -- body styles ----------------------------------------------------------- */
a {
color: #005B81;
text-decoration: none;
}
a:hover {
color: #E32E00;
text-decoration: underline;
}
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
font-family: Arial, sans-serif;
background-color: #BED4EB;
font-weight: normal;
color: #212224;
margin: 30px 0px 10px 0px;
padding: 5px 0 5px 10px;
text-shadow: 0px 1px 0 white
}
div.body h1 { border-top: 20px solid white; margin-top: 0; font-size: 200%; }
div.body h2 { font-size: 150%; background-color: #C8D5E3; }
div.body h3 { font-size: 120%; background-color: #D8DEE3; }
div.body h4 { font-size: 110%; background-color: #D8DEE3; }
div.body h5 { font-size: 100%; background-color: #D8DEE3; }
div.body h6 { font-size: 100%; background-color: #D8DEE3; }
a.headerlink {
color: #c60f0f;
font-size: 0.8em;
padding: 0 4px 0 4px;
text-decoration: none;
}
a.headerlink:hover {
background-color: #c60f0f;
color: white;
}
div.body p, div.body dd, div.body li {
line-height: 1.5em;
}
div.admonition p.admonition-title + p {
display: inline;
}
div.highlight{
background-color: white;
}
div.note {
background-color: #eee;
border: 1px solid #ccc;
}
div.seealso {
background-color: #ffc;
border: 1px solid #ff6;
}
div.topic {
background-color: #eee;
}
div.warning {
background-color: #ffe4e4;
border: 1px solid #f66;
}
p.admonition-title {
display: inline;
}
p.admonition-title:after {
content: ":";
}
pre {
padding: 10px;
background-color: White;
color: #222;
line-height: 1.2em;
border: 1px solid #C6C9CB;
font-size: 1.2em;
margin: 1.5em 0 1.5em 0;
-webkit-box-shadow: 1px 1px 1px #d8d8d8;
-moz-box-shadow: 1px 1px 1px #d8d8d8;
}
tt {
background-color: #ecf0f3;
color: #222;
padding: 1px 2px;
font-size: 1.2em;
font-family: monospace;
}
.c { color: #999988; font-style: italic } /* Comment */
.k { font-weight: bold } /* Keyword */
.o { font-weight: bold } /* Operator */
.cm { color: #999988; font-style: italic } /* Comment.Multiline */
.cp { color: #999999; font-weight: bold } /* Comment.preproc */
.c1 { color: #999988; font-style: italic } /* Comment.Single */
.gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.ge { font-style: italic } /* Generic.Emph */
.gr { color: #aa0000 } /* Generic.Error */
.gh { color: #999999 } /* Generic.Heading */
.gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.go { color: #111 } /* Generic.Output */
.gp { color: #555555 } /* Generic.Prompt */
.gs { font-weight: bold } /* Generic.Strong */
.gu { color: #aaaaaa } /* Generic.Subheading */
.gt { color: #aa0000 } /* Generic.Traceback */
.kc { font-weight: bold } /* Keyword.Constant */
.kd { font-weight: bold } /* Keyword.Declaration */
.kp { font-weight: bold } /* Keyword.Pseudo */
.kr { font-weight: bold } /* Keyword.Reserved */
.kt { color: #445588; font-weight: bold } /* Keyword.Type */
.m { color: #009999 } /* Literal.Number */
.s { color: #bb8844 } /* Literal.String */
.na { color: #008080 } /* Name.Attribute */
.nb { color: #999999 } /* Name.Builtin */
.nc { color: #445588; font-weight: bold } /* Name.Class */
.no { color: #ff99ff } /* Name.Constant */
.ni { color: #800080 } /* Name.Entity */
.ne { color: #990000; font-weight: bold } /* Name.Exception */
.nf { color: #990000; font-weight: bold } /* Name.Function */
.nn { color: #555555 } /* Name.Namespace */
.nt { color: #000080 } /* Name.Tag */
.nv { color: purple } /* Name.Variable */
.ow { font-weight: bold } /* Operator.Word */
.mf { color: #009999 } /* Literal.Number.Float */
.mh { color: #009999 } /* Literal.Number.Hex */
.mi { color: #009999 } /* Literal.Number.Integer */
.mo { color: #009999 } /* Literal.Number.Oct */
.sb { color: #bb8844 } /* Literal.String.Backtick */
.sc { color: #bb8844 } /* Literal.String.Char */
.sd { color: #bb8844 } /* Literal.String.Doc */
.s2 { color: #bb8844 } /* Literal.String.Double */
.se { color: #bb8844 } /* Literal.String.Escape */
.sh { color: #bb8844 } /* Literal.String.Heredoc */
.si { color: #bb8844 } /* Literal.String.Interpol */
.sx { color: #bb8844 } /* Literal.String.Other */
.sr { color: #808000 } /* Literal.String.Regex */
.s1 { color: #bb8844 } /* Literal.String.Single */
.ss { color: #bb8844 } /* Literal.String.Symbol */
.bp { color: #999999 } /* Name.Builtin.Pseudo */
.vc { color: #ff99ff } /* Name.Variable.Class */
.vg { color: #ff99ff } /* Name.Variable.Global */
.vi { color: #ff99ff } /* Name.Variable.Instance */
.il { color: #009999 } /* Literal.Number.Integer.Long */
\ No newline at end of file
[theme]
inherit = basic
stylesheet = nature.css
pygments_style = tango
# -*- coding: utf-8 -*-
#
# Paste documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 22 22:08:49 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (module imports are okay, they're removed automatically).
#
# All configuration values have a default value; values that are commented out
# serve to show the default value.
import sys
# If your extensions are in another directory, add it here.
#sys.path.append('some/directory')
# General configuration
# ---------------------
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc']
# Add any paths that contain templates here, relative to this directory.
## FIXME: disabled for now because I haven't figured out how to use this:
#templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.txt'
# The master toctree document.
master_doc = 'index'
# General substitutions.
project = 'virtualenv'
copyright = '2007-2011, Ian Bicking, The Open Planning Project, The virtualenv developers'
# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
#
# The short X.Y version.
release = "1.7"
version = ".".join(release.split(".")[:2])
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
today_fmt = '%B %d, %Y'
# List of documents that shouldn't be included in the build.
unused_docs = []
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# Options for HTML output
# -----------------------
# The style sheet to use for HTML and HTML Help pages. A file of that name
# must exist either in Sphinx' static/ path, or in one of the custom paths
# given in html_static_path.
#html_style = 'default.css'
html_theme = 'nature'
html_theme_path = ['_theme']
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Content template for the index page.
#html_index = ''
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_use_modindex = True
# If true, the reST sources are included in the HTML build as _sources/<name>.
#html_copy_source = True
# Output file base name for HTML help builder.
htmlhelp_basename = 'Pastedoc'
# Options for LaTeX output
# ------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, document class [howto/manual]).
#latex_documents = []
# Additional stuff for the LaTeX preamble.
#latex_preamble = ''
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_use_modindex = True
...@@ -27,9 +27,16 @@ Project <http://openplans.org>`_ and is now maintained by a ...@@ -27,9 +27,16 @@ Project <http://openplans.org>`_ and is now maintained by a
It is licensed under an It is licensed under an
`MIT-style permissive license <https://github.com/pypa/virtualenv/raw/master/LICENSE.txt>`_. `MIT-style permissive license <https://github.com/pypa/virtualenv/raw/master/LICENSE.txt>`_.
You can install it with ``easy_install virtualenv``, or the `latest You can install it with ``pip install virtualenv``, or the `latest
development version <https://github.com/pypa/virtualenv/tarball/develop#egg=virtualenv-dev>`_ development version <https://github.com/pypa/virtualenv/tarball/develop#egg=virtualenv-dev>`_
with ``easy_install virtualenv==dev``. with ``pip install virtualenv==dev``.
You can also use ``easy_install``, or if you have no Python package manager
available at all, you can just grab the single file `virtualenv.py`_ and run
it with ``python virtualenv.py``.
.. _virtualenv.py: https://raw.github.com/pypa/virtualenv/master/virtualenv.py
What It Does What It Does
------------ ------------
...@@ -79,9 +86,65 @@ Distribute instead of setuptools, just call virtualenv like this:: ...@@ -79,9 +86,65 @@ Distribute instead of setuptools, just call virtualenv like this::
You can also set the environment variable VIRTUALENV_USE_DISTRIBUTE. You can also set the environment variable VIRTUALENV_USE_DISTRIBUTE.
A new virtualenv also includes the `pip <http://pypy.python.org/pypi/pip>`_ A new virtualenv also includes the `pip <http://pypy.python.org/pypi/pip>`_
installer, so you can use `ENV/bin/pip`` to install additional packages into installer, so you can use ``ENV/bin/pip`` to install additional packages into
the environment. the environment.
Environment variables and configuration files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virtualenv can not only be configured by passing command line options such as
``--distribute`` but also by two other means:
- Environment variables
Each command line option is automatically used to look for environment
variables with the name format ``VIRTUALENV_<UPPER_NAME>``. That means
the name of the command line options are capitalized and have dashes
(``'-'``) replaced with underscores (``'_'``).
For example, to automatically install Distribute instead of setuptools
you can also set an environment variable::
$ export VIRTUALENV_USE_DISTRIBUTE=true
$ python virtualenv.py ENV
It's the same as passing the option to virtualenv directly::
$ python virtualenv.py --distribute ENV
This also works for appending command line options, like ``--find-links``.
Just leave an empty space between the passsed values, e.g.::
$ export VIRTUALENV_EXTRA_SEARCH_DIR="/path/to/dists /path/to/other/dists"
$ virtualenv ENV
is the same as calling::
$ python virtualenv.py --extra-search-dir=/path/to/dists --extra-search-dir=/path/to/other/dists ENV
- Config files
virtualenv also looks for a standard ini config file. On Unix and Mac OS X
that's ``$HOME/.virtualenv/virtualenv.ini`` and on Windows, it's
``%HOME%\\virtualenv\\virtualenv.ini``.
The names of the settings are derived from the long command line option,
e.g. the option ``--distribute`` would look like this::
[virtualenv]
distribute = true
Appending options like ``--extra-search-dir`` can be written on multiple
lines::
[virtualenv]
extra-search-dir =
/path/to/dists
/path/to/other/dists
Please have a look at the output of ``virtualenv --help`` for a full list
of supported options.
Windows Notes Windows Notes
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
...@@ -172,7 +235,7 @@ Here's a more concrete example of how you could use this:: ...@@ -172,7 +235,7 @@ Here's a more concrete example of how you could use this::
f = open('blog-bootstrap.py', 'w').write(output) f = open('blog-bootstrap.py', 'w').write(output)
Another example is available `here Another example is available `here
<https://svn.openplans.org/svn/fassembler/trunk/fassembler/create-venv-script.py>`_. <https://github.com/socialplanning/fassembler/blob/master/fassembler/create-venv-script.py>`_.
activate script activate script
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
...@@ -189,7 +252,7 @@ directory. (You have to use ``source`` because it changes your shell ...@@ -189,7 +252,7 @@ directory. (You have to use ``source`` because it changes your shell
environment in-place.) This is all it does; it's purely a convenience. If environment in-place.) This is all it does; it's purely a convenience. If
you directly run a script or the python interpreter from the virtualenv's you directly run a script or the python interpreter from the virtualenv's
``bin/`` directory (e.g. ``path/to/env/bin/pip`` or ``bin/`` directory (e.g. ``path/to/env/bin/pip`` or
``/path/to/env/bin/python script.py``) there's no need for activation. ``/path/to/env/bin/python script.py``) there's no need for activation.
After activating an environment you can use the function ``deactivate`` to After activating an environment you can use the function ``deactivate`` to
undo the changes to your ``$PATH``. undo the changes to your ``$PATH``.
...@@ -207,15 +270,16 @@ On Windows you just do:: ...@@ -207,15 +270,16 @@ On Windows you just do::
And use ``deactivate.bat`` to undo the changes. And use ``deactivate.bat`` to undo the changes.
The ``--no-site-packages`` Option The ``--system-site-packages`` Option
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you build with ``virtualenv --system-site-packages ENV``, your virtual
environment will inherit packages from ``/usr/lib/python2.7/site-packages``
(or wherever your global site-packages directory is).
If you build with ``virtualenv --no-site-packages ENV`` it will *not* This can be used if you have control over the global site-packages directory,
inherit any packages from ``/usr/lib/python2.5/site-packages`` (or and you want to depend on the packages there. If you want isolation from the
wherever your global site-packages directory is). This can be used if global system, do not use this flag.
you don't have control over site-packages and don't want to depend on
the packages there, or you just want more isolation from the global
system.
Using Virtualenv without ``bin/python`` Using Virtualenv without ``bin/python``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -236,11 +300,12 @@ can setup the environment like:: ...@@ -236,11 +300,12 @@ can setup the environment like::
This will change ``sys.path`` and even change ``sys.prefix``, but also allow This will change ``sys.path`` and even change ``sys.prefix``, but also allow
you to use an existing interpreter. Items in your environment will show up you to use an existing interpreter. Items in your environment will show up
first on ``sys.path``, before global items. However, global items will first on ``sys.path``, before global items. However, global items will
always be accessible -- this technique does not support the always be accessible (as if the ``--system-site-packages`` flag had been used
``--no-site-packages`` flag. Also, this cannot undo the activation of other in creating the environment, whether it was or not). Also, this cannot undo
environments, or modules that have been imported. You shouldn't try to, for the activation of other environments, or modules that have been imported.
instance, activate an environment before a web request; you should activate You shouldn't try to, for instance, activate an environment before a web
*one* environment as early as possible, and not do it again in that process. request; you should activate *one* environment as early as possible, and not
do it again in that process.
Making Environments Relocatable Making Environments Relocatable
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -277,8 +342,8 @@ libraries on the system, if those C libraries are located somewhere ...@@ -277,8 +342,8 @@ libraries on the system, if those C libraries are located somewhere
different (either different versions, or a different filesystem different (either different versions, or a different filesystem
layout). layout).
Currently the ``--no-site-packages`` option will not be honored if you If you use this flag to create an environment, currently, the
use this on an environment. ``--system-site-packages`` option will be implied.
The ``--extra-search-dir`` Option The ``--extra-search-dir`` Option
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
@ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. changes to make an overview over all changed/added/deprecated items
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\django-compressor.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\django-compressor.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
:end
Changes & News Changes & News
-------------- --------------
Next release (1.7) schedule 1.7 (2011-11-30)
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
Beta release mid-July 2011, final release early August. * Updated embedded Distribute release to 0.6.24. Thanks Alex Grönholm.
* Made ``--no-site-packages`` behavior the default behavior. The
``--no-site-packages`` flag is still permitted, but displays a warning when
used. Thanks Chris McDonough.
* New flag: ``--system-site-packages``; this flag should be passed to get the
previous default global-site-package-including behavior back.
* Added ability to set command options as environment variables and options
in a ``virtualenv.ini`` file.
* Fixed various encoding related issues with paths. Thanks Gunnlaugur Thor Briem.
* Made ``virtualenv.py`` script executable.
1.6.4 (2011-07-21) 1.6.4 (2011-07-21)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
......
...@@ -26,7 +26,7 @@ f.close() ...@@ -26,7 +26,7 @@ f.close()
setup(name='virtualenv', setup(name='virtualenv',
# If you change the version here, change it in virtualenv.py and # If you change the version here, change it in virtualenv.py and
# docs/conf.py as well # docs/conf.py as well
version="1.6.4", version="1.7",
description="Virtual Python Environment builder", description="Virtual Python Environment builder",
long_description=long_description, long_description=long_description,
classifiers=[ classifiers=[
......
import virtualenv
from mock import patch, Mock
def test_version():
"""Should have a version string"""
assert virtualenv.virtualenv_version == "1.7", "Should have version"
@patch('os.path.exists')
def test_resolve_interpreter_with_absolute_path(mock_exists):
"""Should return absolute path if given and exists"""
mock_exists.return_value = True
virtualenv.is_executable = Mock(return_value=True)
exe = virtualenv.resolve_interpreter("/usr/bin/python42")
assert exe == "/usr/bin/python42", "Absolute path should return as is"
mock_exists.assert_called_with("/usr/bin/python42")
virtualenv.is_executable.assert_called_with("/usr/bin/python42")
@patch('os.path.exists')
def test_resolve_intepreter_with_nonexistant_interpreter(mock_exists):
"""Should exit when with absolute path if not exists"""
mock_exists.return_value = False
try:
virtualenv.resolve_interpreter("/usr/bin/python42")
assert False, "Should raise exception"
except SystemExit:
pass
mock_exists.assert_called_with("/usr/bin/python42")
@patch('os.path.exists')
def test_resolve_intepreter_with_invalid_interpreter(mock_exists):
"""Should exit when with absolute path if not exists"""
mock_exists.return_value = True
virtualenv.is_executable = Mock(return_value=False)
try:
virtualenv.resolve_interpreter("/usr/bin/python42")
assert False, "Should raise exception"
except SystemExit:
pass
mock_exists.assert_called_with("/usr/bin/python42")
virtualenv.is_executable.assert_called_with("/usr/bin/python42")
Metadata-Version: 1.0 Metadata-Version: 1.0
Name: virtualenv Name: virtualenv
Version: 1.6.4 Version: 1.7
Summary: Virtual Python Environment builder Summary: Virtual Python Environment builder
Home-page: http://www.virtualenv.org Home-page: http://www.virtualenv.org
Author: Jannis Leidel, Carl Meyer and Brian Rosner Author: Jannis Leidel, Carl Meyer and Brian Rosner
...@@ -22,9 +22,16 @@ Description: ...@@ -22,9 +22,16 @@ Description:
It is licensed under an It is licensed under an
`MIT-style permissive license <https://github.com/pypa/virtualenv/raw/master/LICENSE.txt>`_. `MIT-style permissive license <https://github.com/pypa/virtualenv/raw/master/LICENSE.txt>`_.
You can install it with ``easy_install virtualenv``, or the `latest You can install it with ``pip install virtualenv``, or the `latest
development version <https://github.com/pypa/virtualenv/tarball/develop#egg=virtualenv-dev>`_ development version <https://github.com/pypa/virtualenv/tarball/develop#egg=virtualenv-dev>`_
with ``easy_install virtualenv==dev``. with ``pip install virtualenv==dev``.
You can also use ``easy_install``, or if you have no Python package manager
available at all, you can just grab the single file `virtualenv.py`_ and run
it with ``python virtualenv.py``.
.. _virtualenv.py: https://raw.github.com/pypa/virtualenv/master/virtualenv.py
What It Does What It Does
------------ ------------
...@@ -74,9 +81,65 @@ Description: ...@@ -74,9 +81,65 @@ Description:
You can also set the environment variable VIRTUALENV_USE_DISTRIBUTE. You can also set the environment variable VIRTUALENV_USE_DISTRIBUTE.
A new virtualenv also includes the `pip <http://pypy.python.org/pypi/pip>`_ A new virtualenv also includes the `pip <http://pypy.python.org/pypi/pip>`_
installer, so you can use `ENV/bin/pip`` to install additional packages into installer, so you can use ``ENV/bin/pip`` to install additional packages into
the environment. the environment.
Environment variables and configuration files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virtualenv can not only be configured by passing command line options such as
``--distribute`` but also by two other means:
- Environment variables
Each command line option is automatically used to look for environment
variables with the name format ``VIRTUALENV_<UPPER_NAME>``. That means
the name of the command line options are capitalized and have dashes
(``'-'``) replaced with underscores (``'_'``).
For example, to automatically install Distribute instead of setuptools
you can also set an environment variable::
$ export VIRTUALENV_USE_DISTRIBUTE=true
$ python virtualenv.py ENV
It's the same as passing the option to virtualenv directly::
$ python virtualenv.py --distribute ENV
This also works for appending command line options, like ``--find-links``.
Just leave an empty space between the passsed values, e.g.::
$ export VIRTUALENV_EXTRA_SEARCH_DIR="/path/to/dists /path/to/other/dists"
$ virtualenv ENV
is the same as calling::
$ python virtualenv.py --extra-search-dir=/path/to/dists --extra-search-dir=/path/to/other/dists ENV
- Config files
virtualenv also looks for a standard ini config file. On Unix and Mac OS X
that's ``$HOME/.virtualenv/virtualenv.ini`` and on Windows, it's
``%HOME%\\virtualenv\\virtualenv.ini``.
The names of the settings are derived from the long command line option,
e.g. the option ``--distribute`` would look like this::
[virtualenv]
distribute = true
Appending options like ``--extra-search-dir`` can be written on multiple
lines::
[virtualenv]
extra-search-dir =
/path/to/dists
/path/to/other/dists
Please have a look at the output of ``virtualenv --help`` for a full list
of supported options.
Windows Notes Windows Notes
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
...@@ -167,7 +230,7 @@ Description: ...@@ -167,7 +230,7 @@ Description:
f = open('blog-bootstrap.py', 'w').write(output) f = open('blog-bootstrap.py', 'w').write(output)
Another example is available `here Another example is available `here
<https://svn.openplans.org/svn/fassembler/trunk/fassembler/create-venv-script.py>`_. <https://github.com/socialplanning/fassembler/blob/master/fassembler/create-venv-script.py>`_.
activate script activate script
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
...@@ -184,7 +247,7 @@ Description: ...@@ -184,7 +247,7 @@ Description:
environment in-place.) This is all it does; it's purely a convenience. If environment in-place.) This is all it does; it's purely a convenience. If
you directly run a script or the python interpreter from the virtualenv's you directly run a script or the python interpreter from the virtualenv's
``bin/`` directory (e.g. ``path/to/env/bin/pip`` or ``bin/`` directory (e.g. ``path/to/env/bin/pip`` or
``/path/to/env/bin/python script.py``) there's no need for activation. ``/path/to/env/bin/python script.py``) there's no need for activation.
After activating an environment you can use the function ``deactivate`` to After activating an environment you can use the function ``deactivate`` to
undo the changes to your ``$PATH``. undo the changes to your ``$PATH``.
...@@ -202,15 +265,16 @@ Description: ...@@ -202,15 +265,16 @@ Description:
And use ``deactivate.bat`` to undo the changes. And use ``deactivate.bat`` to undo the changes.
The ``--no-site-packages`` Option The ``--system-site-packages`` Option
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you build with ``virtualenv --system-site-packages ENV``, your virtual
environment will inherit packages from ``/usr/lib/python2.7/site-packages``
(or wherever your global site-packages directory is).
If you build with ``virtualenv --no-site-packages ENV`` it will *not* This can be used if you have control over the global site-packages directory,
inherit any packages from ``/usr/lib/python2.5/site-packages`` (or and you want to depend on the packages there. If you want isolation from the
wherever your global site-packages directory is). This can be used if global system, do not use this flag.
you don't have control over site-packages and don't want to depend on
the packages there, or you just want more isolation from the global
system.
Using Virtualenv without ``bin/python`` Using Virtualenv without ``bin/python``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -231,11 +295,12 @@ Description: ...@@ -231,11 +295,12 @@ Description:
This will change ``sys.path`` and even change ``sys.prefix``, but also allow This will change ``sys.path`` and even change ``sys.prefix``, but also allow
you to use an existing interpreter. Items in your environment will show up you to use an existing interpreter. Items in your environment will show up
first on ``sys.path``, before global items. However, global items will first on ``sys.path``, before global items. However, global items will
always be accessible -- this technique does not support the always be accessible (as if the ``--system-site-packages`` flag had been used
``--no-site-packages`` flag. Also, this cannot undo the activation of other in creating the environment, whether it was or not). Also, this cannot undo
environments, or modules that have been imported. You shouldn't try to, for the activation of other environments, or modules that have been imported.
instance, activate an environment before a web request; you should activate You shouldn't try to, for instance, activate an environment before a web
*one* environment as early as possible, and not do it again in that process. request; you should activate *one* environment as early as possible, and not
do it again in that process.
Making Environments Relocatable Making Environments Relocatable
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -272,8 +337,8 @@ Description: ...@@ -272,8 +337,8 @@ Description:
different (either different versions, or a different filesystem different (either different versions, or a different filesystem
layout). layout).
Currently the ``--no-site-packages`` option will not be honored if you If you use this flag to create an environment, currently, the
use this on an environment. ``--system-site-packages`` option will be implied.
The ``--extra-search-dir`` Option The ``--extra-search-dir`` Option
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -419,10 +484,24 @@ Description: ...@@ -419,10 +484,24 @@ Description:
Changes & News Changes & News
-------------- --------------
Next release (1.7) schedule 1.7 (2011-11-30)
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
* Updated embedded Distribute release to 0.6.24. Thanks Alex Grönholm.
* Made ``--no-site-packages`` behavior the default behavior. The
``--no-site-packages`` flag is still permitted, but displays a warning when
used. Thanks Chris McDonough.
* New flag: ``--system-site-packages``; this flag should be passed to get the
previous default global-site-package-including behavior back.
* Added ability to set command options as environment variables and options
in a ``virtualenv.ini`` file.
* Fixed various encoding related issues with paths. Thanks Gunnlaugur Thor Briem.
Beta release mid-July 2011, final release early August. * Made ``virtualenv.py`` script executable.
1.6.4 (2011-07-21) 1.6.4 (2011-07-21)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
......
AUTHORS.txt AUTHORS.txt
HACKING
LICENSE.txt LICENSE.txt
MANIFEST.in MANIFEST.in
setup.py setup.py
virtualenv.py virtualenv.py
bin/rebuild-script.py
bin/refresh-support-files.py
docs/Makefile
docs/conf.py
docs/index.txt docs/index.txt
docs/make.bat
docs/news.txt docs/news.txt
docs/_theme/nature/theme.conf
docs/_theme/nature/static/nature.css_t
docs/_theme/nature/static/pygments.css
scripts/virtualenv scripts/virtualenv
tests/__init__.py
tests/test_virtualenv.py
virtualenv.egg-info/PKG-INFO virtualenv.egg-info/PKG-INFO
virtualenv.egg-info/SOURCES.txt virtualenv.egg-info/SOURCES.txt
virtualenv.egg-info/dependency_links.txt virtualenv.egg-info/dependency_links.txt
...@@ -13,7 +24,13 @@ virtualenv.egg-info/entry_points.txt ...@@ -13,7 +24,13 @@ virtualenv.egg-info/entry_points.txt
virtualenv.egg-info/not-zip-safe virtualenv.egg-info/not-zip-safe
virtualenv.egg-info/top_level.txt virtualenv.egg-info/top_level.txt
virtualenv_support/__init__.py virtualenv_support/__init__.py
virtualenv_support/distribute-0.6.19.tar.gz virtualenv_support/activate.bat
virtualenv_support/activate.csh
virtualenv_support/activate.fish
virtualenv_support/activate.sh
virtualenv_support/deactivate.bat
virtualenv_support/distribute-0.6.24.tar.gz
virtualenv_support/distutils.cfg
virtualenv_support/pip-1.0.2.tar.gz virtualenv_support/pip-1.0.2.tar.gz
virtualenv_support/setuptools-0.6c11-py2.4.egg virtualenv_support/setuptools-0.6c11-py2.4.egg
virtualenv_support/setuptools-0.6c11-py2.5.egg virtualenv_support/setuptools-0.6c11-py2.5.egg
......
@echo off
set VIRTUAL_ENV=__VIRTUAL_ENV__
if not defined PROMPT (
set PROMPT=$P$G
)
if defined _OLD_VIRTUAL_PROMPT (
set PROMPT=%_OLD_VIRTUAL_PROMPT%
)
if defined _OLD_VIRTUAL_PYTHONHOME (
set PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%
)
set _OLD_VIRTUAL_PROMPT=%PROMPT%
set PROMPT=__VIRTUAL_WINPROMPT__ %PROMPT%
if defined PYTHONHOME (
set _OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%
set PYTHONHOME=
)
if defined _OLD_VIRTUAL_PATH set PATH=%_OLD_VIRTUAL_PATH%; goto SKIPPATH
set _OLD_VIRTUAL_PATH=%PATH%
:SKIPPATH
set PATH=%VIRTUAL_ENV%\__BIN_NAME__;%PATH%
:END
# This file must be used with "source bin/activate.csh" *from csh*.
# You cannot run it directly.
# Created by Davide Di Blasi <davidedb@gmail.com>.
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate'
# Unset irrelavent variables.
deactivate nondestructive
setenv VIRTUAL_ENV "__VIRTUAL_ENV__"
set _OLD_VIRTUAL_PATH="$PATH"
setenv PATH "$VIRTUAL_ENV/__BIN_NAME__:$PATH"
set _OLD_VIRTUAL_PROMPT="$prompt"
if ("__VIRTUAL_PROMPT__" != "") then
set env_name = "__VIRTUAL_PROMPT__"
else
if (`basename "$VIRTUAL_ENV"` == "__") then
# special case for Aspen magic directories
# see http://www.zetadev.com/software/aspen/
set env_name = `basename \`dirname "$VIRTUAL_ENV"\``
else
set env_name = `basename "$VIRTUAL_ENV"`
endif
endif
set prompt = "[$env_name] $prompt"
unset env_name
rehash
# This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org)
# you cannot run it directly
function deactivate -d "Exit virtualenv and return to normal shell environment"
# reset old environment variables
if test -n "$_OLD_VIRTUAL_PATH"
set -gx PATH $_OLD_VIRTUAL_PATH
set -e _OLD_VIRTUAL_PATH
end
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
set -e _OLD_VIRTUAL_PYTHONHOME
end
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
functions -e fish_prompt
set -e _OLD_FISH_PROMPT_OVERRIDE
end
set -e VIRTUAL_ENV
if test "$argv[1]" != "nondestructive"
# Self destruct!
functions -e deactivate
end
end
# unset irrelavent variables
deactivate nondestructive
set -gx VIRTUAL_ENV "__VIRTUAL_ENV__"
set -gx _OLD_VIRTUAL_PATH $PATH
set -gx PATH "$VIRTUAL_ENV/__BIN_NAME__" $PATH
# unset PYTHONHOME if set
if set -q PYTHONHOME
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
set -e PYTHONHOME
end
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
# fish shell uses a function, instead of env vars,
# to produce the prompt. Overriding the existing function is easy.
# However, adding to the current prompt, instead of clobbering it,
# is a little more work.
set -l oldpromptfile (tempfile)
if test $status
# save the current fish_prompt function...
echo "function _old_fish_prompt" >> $oldpromptfile
echo -n \# >> $oldpromptfile
functions fish_prompt >> $oldpromptfile
# we've made the "_old_fish_prompt" file, source it.
. $oldpromptfile
rm -f $oldpromptfile
if test -n "__VIRTUAL_PROMPT__"
# We've been given us a prompt override.
#
# FIXME: Unsure how to handle this *safely*. We could just eval()
# whatever is given, but the risk is a bit much.
echo "activate.fish: Alternative prompt prefix is not supported under fish-shell." 1>&2
echo "activate.fish: Alter the fish_prompt in this file as needed." 1>&2
end
# with the original prompt function renamed, we can override with our own.
function fish_prompt
set -l _checkbase (basename "$VIRTUAL_ENV")
if test $_checkbase = "__"
# special case for Aspen magic directories
# see http://www.zetadev.com/software/aspen/
printf "%s[%s]%s %s" (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal) (_old_fish_prompt)
else
printf "%s(%s)%s%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal) (_old_fish_prompt)
end
end
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
end
end
# This file must be used with "source bin/activate" *from bash*
# you cannot run it directly
deactivate () {
# reset old environment variables
if [ -n "$_OLD_VIRTUAL_PATH" ] ; then
PATH="$_OLD_VIRTUAL_PATH"
export PATH
unset _OLD_VIRTUAL_PATH
fi
if [ -n "$_OLD_VIRTUAL_PYTHONHOME" ] ; then
PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
export PYTHONHOME
unset _OLD_VIRTUAL_PYTHONHOME
fi
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
hash -r
fi
if [ -n "$_OLD_VIRTUAL_PS1" ] ; then
PS1="$_OLD_VIRTUAL_PS1"
export PS1
unset _OLD_VIRTUAL_PS1
fi
unset VIRTUAL_ENV
if [ ! "$1" = "nondestructive" ] ; then
# Self destruct!
unset -f deactivate
fi
}
# unset irrelavent variables
deactivate nondestructive
VIRTUAL_ENV="__VIRTUAL_ENV__"
export VIRTUAL_ENV
_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/__BIN_NAME__:$PATH"
export PATH
# unset PYTHONHOME if set
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
# could use `if (set -u; : $PYTHONHOME) ;` in bash
if [ -n "$PYTHONHOME" ] ; then
_OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
unset PYTHONHOME
fi
if [ -z "$VIRTUAL_ENV_DISABLE_PROMPT" ] ; then
_OLD_VIRTUAL_PS1="$PS1"
if [ "x__VIRTUAL_PROMPT__" != x ] ; then
PS1="__VIRTUAL_PROMPT__$PS1"
else
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
# special case for Aspen magic directories
# see http://www.zetadev.com/software/aspen/
PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
else
PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
fi
fi
export PS1
fi
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
hash -r
fi
@echo off
if defined _OLD_VIRTUAL_PROMPT (
set PROMPT=%_OLD_VIRTUAL_PROMPT%
)
set _OLD_VIRTUAL_PROMPT=
if defined _OLD_VIRTUAL_PYTHONHOME (
set PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%
set _OLD_VIRTUAL_PYTHONHOME=
)
if defined _OLD_VIRTUAL_PATH set PATH=%_OLD_VIRTUAL_PATH%
set _OLD_VIRTUAL_PATH=
:END
# This is a config file local to this virtualenv installation
# You may include options that will be used by all distutils commands,
# and by easy_install. For instance:
#
# [easy_install]
# find_links = http://mylocalsite
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